python - Django-cron not executing job -
i trying use django-cron regularly run script on django server. seems though cronscheduler registering test class "class ran" prints terminal, have not found indication job run (i.e. have not seen "job ran" printed terminal). in case shouldn't have been relying on printing know if job running, watched django_cron_job table in database few minutes see if job's "last_run" value changed after sending request server found did not.
just know: each time test have been hitting server 1 request job start, have modified cron_polling_frequency
in settings file lower run_every
value specify job, , ensured job set queued per posts' suggestion: similar problem.
in order solve error getting ("attributeerror: 'settings' object has no attribute 'project_dir'"), set project_dir os.path.dirname(__file__)
in settings.py. problem?
i following when start server i've looked , couldn't find reason why problem:
"runtimewarning: datetimefield received naive datetime (2013-07-23 13:55:56.016085) while time zone support active."
the other thing of note retrieve following printout terminal few seconds after relaunching server , hitting server request, happens once until restart server:
"already executing oops! process pid 17099 not running. fixing status in db. validating models..."
my cron.py file:
from django_cron import cronscheduler, job, hour, day, week, month import sys class test(job): print "class ran" run_every=2 def job(self): print "job ran" cronscheduler.register(test)
got it: looked on things again few times after posting , noticed last_run
date in database hours before current time, job didn't think needed start until hit time + run_every
specification. datetimefield runtimewarning was problem after all. tested manually changing last_run date , got printout expected. need figure out how solve timezone related problem. hope can someone!
Comments
Post a Comment