question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

scheduler creating duplicate tasks in multiple cluster environment

See original GitHub issue

We have a service that uses django-q for asynchronous tasks and it’s deployed as 2 instances (2 AWS EC2 servers each running the same django project and each running a django-q cluster to process tasks). We’ve encountered an issue where the same scheduled task – scheduled to run once – gets picked up by each of the clusters in the scheduler (django-q.cluster) and ends up having 2 separate tasks being created.

Example entries in our logs:

On server 1:

2017-04-02 20:25:56,747 - django-q - INFO - Process-1 created a task from schedule [14789]
2017-04-02 20:25:56,842 - django-q - DEBUG - Pushed ('hamper-india-magnesium-pip', 'f1a1141c1835400ebc4f4b3894922b82')

On server 2:

2017-04-02 20:25:56,853 - django-q - INFO - Process-1 created a task from schedule [14789]
2017-04-02 20:25:56,990 - django-q - DEBUG - Pushed ('alpha-william-kansas-apart', '5a4fcadb47674590933415dd5a71e1cc')

Is this the expected behavior or is it a bug?

What we are looking for is to have a scheduled task create only one async task to execute the action, even in a multi-cluster setup like ours.

Can you comment on this behavior?

We’re using:

Django (1.10.6)
django-q (0.7.18)

Thanks

-Kevin

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
marcelolimacommented, Aug 7, 2019

I’m also facing the same issue and disabling the schedule on all but one machine is not easy in my case because of auto-scaling. Is there any update on this issue other than the suggested workaround? I noticed there is this PR https://github.com/Koed00/django-q/pull/347 that seems to fix the issue, but still in open.

1reaction
kefincommented, Aug 13, 2019

Thank you @Koed00 for merging PR #347.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring and scheduled tasks on multiple instances
You can configure your application to have multiple profiles. For example use another profile 'cron' . And start your application on only one ......
Read more >
Why is Windows Task Scheduler trying to launch multiple ...
This is the issue described in KB2617046: if you disable and then enable a scheduled task, duplicate triggers are created. The task properties...
Read more >
How can you make a cluster run a task only once?
The job must only be run once per schedule. If multiple jobs are scheduled at the same time or at overlapping times that...
Read more >
Duplicating pipeline tasks - Cloud - Talend Help Center
The task is duplicated with the latest version of the artifact, and -Copy is appended to its title. You must edit the new...
Read more >
Scheduled Tasks Across a Cluster - ForgeRock Backstage
In a clustered environment, the scheduler service looks for pending jobs and handles them as follows: ... Jobs that are configured as persistent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found