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

Scheduler cancelling all jobs in all queues when specific queue name was supposed to cancel #275

Open
munzzz5 opened this issue Jan 15, 2022 · 1 comment

Comments

@munzzz5
Copy link

munzzz5 commented Jan 15, 2022

I am trying to schedule the main jobs in the default queue, But secondary jobs in another queue called "systemTriggers". The Job is scheduled in the second queue. when i cancel jobs in "systemTriggers" all jobs of default queue are also cancelled.

Here is how im doing this:

scheduler = Scheduler("systemTriggers",connection=Redis())
allJobs=scheduler.get_jobs()
for job in allJobs:
      scheduler.cancel(job)
scheduler.scheduler(newJob) # this is to avoid duplication whenever my django reloads as this is startup code


Thanks!

@emuccino
Copy link

emuccino commented May 5, 2022

I'm facing the same issue. My workaround is to filter jobs by the queue_name stored in the origin property. Here's how it would work using @munzzz5 example:

scheduler = Scheduler("systemTriggers",connection=Redis())
allJobs=scheduler.get_jobs()
for job in allJobs:
      if job.origin == "systemTriggers": # check that the job is from the desired queue
              scheduler.cancel(job)
scheduler.scheduler(newJob)

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

2 participants