Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Change order of jobs #1087

Closed
f0cker opened this issue May 7, 2019 · 5 comments
Closed

Feature Request: Change order of jobs #1087

f0cker opened this issue May 7, 2019 · 5 comments

Comments

@f0cker
Copy link
Contributor

f0cker commented May 7, 2019

I couldn't find the option in the docs or in the source, but a feature to move a job in a queue would be great. In other words reorder the jobs, putting specific jobs above others. I know we can use higher priority queues etc., but I think the ability to move the job up or down the queue would also make a good feature. It could be done by popping all the jobs and re-adding them in the required order, but that just seems like it should be unnecessary. Is there any other way?

I'm happy to work on this, but I just wanted to double check it's not already possible and if you have any specific requirements or suggestions around this before I start. Thanks.

@selwin
Copy link
Collaborator

selwin commented May 25, 2019

No, it's not currently possible to reorder jobs. However, RQ supports job dependencies. This allows you to create foo_job that is only enqueued after bar_job executes successfully.

Reordering job also sounds like it will be an expensive operation on large queues.

Does this help?

@theodesp
Copy link
Contributor

A new kind of queue such as a priority queue might be useful in that situation.

@f0cker
Copy link
Contributor Author

f0cker commented Jun 23, 2019

Thanks for the replies. Looking at priority queues, that should work. I think it might also be possible using a FIFO queue if using a list, with the LINSERT Redis command. What queue type does RQ use currently - is it a FIFO/list or something else?

@selwin
Copy link
Collaborator

selwin commented Jul 20, 2019

By default, enqueued jobs are processed on a FIFO basis.

You can use queue.enqueue(at_front=True) to put a job to the front most of the queue to be processed.

@selwin selwin closed this as completed Jul 20, 2019
@ThomasJon196
Copy link

Was the re-arrangement of tasks implemented by now?
Has someone a suggestion for an alternative approach to rearrange tasks ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants