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 :-)
We run a lot of jobs. Occasionally I'll get an exception that looks like this:
File "/var/lib/wwwrun/.virtualenvs/supportlink/lib/python3.4/site-packages/django_cron/__init__.py", line 210, in run
with self.lock_class(cron_job_class, self.silent):
File "/var/lib/wwwrun/.virtualenvs/supportlink/lib/python3.4/site-packages/django_cron/backends/lock/base.py", line 60, in __enter__
raise self.LockFailedException(self.lock_failed_message())
File "/var/lib/wwwrun/.virtualenvs/supportlink/lib/python3.4/site-packages/django_cron/backends/lock/cache.py", line 47, in lock_failed_message
started = self.get_running_lock_date()
File "/var/lib/wwwrun/.virtualenvs/supportlink/lib/python3.4/site-packages/django_cron/backends/lock/cache.py", line 90, in get_running_lock_date
if not timezone.is_aware(date):
File "/var/lib/wwwrun/.virtualenvs/supportlink/lib/python3.4/site-packages/django/utils/timezone.py", line 261, in is_aware
return value.utcoffset() is not None
AttributeError: 'NoneType' object has no attribute 'utcoffset'
get_running_lock_date does not check if the cache returned None.
We run a lot of jobs. Occasionally I'll get an exception that looks like this:
get_running_lock_date does not check if the cache returned None.