Tivix / django-cron

Write cron business logic as a Python class and let this app do the rest! It enables Django projects to schedule cron tasks, tracks their success / failures, manages contention (via a cache) etc. Basically takes care of all the boring work for you :-)
www.tivix.com
MIT License
900 stars 193 forks source link

Question about calling runcrons while a previous job is happening #67

Closed DanielStevenLewis closed 8 years ago

DanielStevenLewis commented 9 years ago

If manage.py runcrons is called while a django-cron do function hasn't yet finished running, and that django-cron do function isn't scheduled to run again yet at that point in time, will there be a problem? I'm asking because I'm wondering whether some issues I'm experiencing might be due to having scheduled the (crontab -e) cron job to run too frequently.

craiglabenz commented 9 years ago

django-cron uses your configured cache backend to store which jobs are currently in-flight. Unless you designate a job as being able to run in parallel, django-cron will not re-invoke it while an earlier version is still working.

chachra commented 8 years ago

@craiglabenz thanks for answering. @DanielStevenLewis as Craig mentioned its all configurable. If you allow parallel runs and crontab executes these quicker than necessary (say via bash file that goes in a loop) or every second and the cron python execution is slow because of whatever reason, then you could easily end up with a ton of processes which is a potential problem. Hence by default parallel runs for the same cron (code) don't work.