[GH-ISSUE #871] Order of task execution #428

Open
opened 2026-03-02 05:21:08 +03:00 by kerem · 6 comments
Owner

Originally created by @dikdom on GitHub (Apr 25, 2024).
Original GitHub issue: https://github.com/hibiken/asynq/issues/871

Hello,
is there any guarantee of the task execution order depending on the enqueue order?
I know this sounds silly as this is a queue but unfortunately I have some contradicting experience. Shall I continue investigating my setup or there is no guarantee of the order of the task executions?
Thanks!

Originally created by @dikdom on GitHub (Apr 25, 2024). Original GitHub issue: https://github.com/hibiken/asynq/issues/871 Hello, is there any guarantee of the task execution order depending on the enqueue order? I know this sounds silly as this is a queue but unfortunately I have some contradicting experience. Shall I continue investigating my setup or there is no guarantee of the order of the task executions? Thanks!
Author
Owner

@kamikazechaser commented on GitHub (Apr 26, 2024):

Well there are ways to achieve something similar. Forcing lower concurrency, checking previous task status in task handlers. But there are no guarantees in any case.

<!-- gh-comment-id:2078576401 --> @kamikazechaser commented on GitHub (Apr 26, 2024): Well there are ways to achieve something similar. Forcing lower concurrency, checking previous task status in task handlers. But there are no guarantees in any case.
Author
Owner

@dikdom commented on GitHub (Apr 29, 2024):

That is sad, I mean this is meant to be a queue. In theory when there is only one process that executes the tasks, then the order of the executions should be the same order as they were inserted in the queue. Am I missing here something?

<!-- gh-comment-id:2082152289 --> @dikdom commented on GitHub (Apr 29, 2024): That is sad, I mean this is meant to be a queue. In theory when there is only one process that executes the tasks, then the order of the executions _should be_ the same order as they were inserted in the queue. Am I missing here something?
Author
Owner

@Joker666 commented on GitHub (Oct 11, 2024):

@dikdom what you are looking for is called a workflow. Asynq does not support that. Try River Pro, it supports workflows.

<!-- gh-comment-id:2406625018 --> @Joker666 commented on GitHub (Oct 11, 2024): @dikdom what you are looking for is called a workflow. `Asynq` does not support that. Try River Pro, it supports workflows.
Author
Owner

@sanudatta11 commented on GitHub (Oct 25, 2024):

what you generally want is kind of like a state machine inside a queue handler

<!-- gh-comment-id:2438517891 --> @sanudatta11 commented on GitHub (Oct 25, 2024): what you generally want is kind of like a state machine inside a queue handler
Author
Owner

@kamikazechaser commented on GitHub (Oct 26, 2024):

https://github.com/yuyang0/dagflow

<!-- gh-comment-id:2439366269 --> @kamikazechaser commented on GitHub (Oct 26, 2024): https://github.com/yuyang0/dagflow
Author
Owner

@PterX commented on GitHub (Jan 17, 2025):

I had a similar need, and I finally implemented it in a simple way. I created an asynq middleware to maintain a dependency relationship of task type. In the middle, it records whether all the dependent tasks have been executed. Otherwise, the dependent tasks will be requeued until they are depended on. All tasks have been completed

<!-- gh-comment-id:2597633467 --> @PterX commented on GitHub (Jan 17, 2025): I had a similar need, and I finally implemented it in a simple way. I created an asynq middleware to maintain a dependency relationship of task type. In the middle, it records whether all the dependent tasks have been executed. Otherwise, the dependent tasks will be requeued until they are depended on. All tasks have been completed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#428
No description provided.