pythondjangodjango-cron

What happens if multiple runcrons is executed


I have multiple cron jobs written in Django and I'm using package django-cron. If I run the following command multiple times, what will happen?

python manage.py runcrons

I want if second runcrons sees that some cron job is executing by the first runcrons, simply ignore it and don't wait for the first one to be completed!


Solution

  • If you use django-cron, you'll be interested in the locking backend.

    You can set ALLOW_PARALLEL_RUNS in your cron class to disallow multiple jobs of the type from running concurrently.