rq / rq-scheduler

A lightweight library that adds job scheduling capabilities to RQ (Redis Queue)
MIT License
1.45k stars 230 forks source link

Scheduled jobs always have the same job ID #235

Open benshanahan1 opened 4 years ago

benshanahan1 commented 4 years ago

Hi. This library is super helpful, thank you! I have a job that is scheduled using the scheduler.cron() method, e.g.:

scheduler.cron(
    "0 8 * * *",
    func=my_scheduled_func,
    use_local_timezone=True,
)

This job is added to the queue at 8am each morning, as expected. However, it is always added with the exact same job ID. Is this expected behavior? Is it possible to have the job be assigned a unique ID each time it is re-queued rather than the same ID?

Thanks!

taewookim commented 4 years ago

that's the expected behavior

benshanahan1 commented 4 years ago

that's the expected behavior

Thanks! Is it possible for the job to be assigned a unique ID each time it is re-queued?

vitorhenrique123 commented 1 year ago

Including a question here: Is there any way to at least get the result of a specific execution? For example: I have a task that will run every day, but I would like to manage its state. How will I know the result/status of an execution on a specific day, if it keeps the same id?

stevennic commented 1 year ago

that's the expected behavior

Thanks! Is it possible for the job to be assigned a unique ID each time it is re-queued?

+1 for at least providing an option to spin off / clone a new job for each cron run. It would be really helpful for the logic of my application too, which considers one job to be one run instance. It would also help with @vitorhenrique123's use case, since each job run would have its own status information.