python - APscheduler doesnt execute jobs when added from a wrapper function -
def print_hello(what): print 'remind working' print def test(sender,kw): regex="remind me (to) (?p<reminder_text>.*?) (at|on|in) (?p<remind_time>.*)?" m=re.match(regex,kw['text'],re.dotall) if m: what=m.group("reminder_text") when=m.group("remind_time") when=nt.parse_natural_time(when) print when scheduler.add_job(print_hello, 'date', name='testme', run_date=when,args=[what]) scheduler.print_jobs()`
the job gets added scheduler job doesn't run.
however when execute this:
def print_hello(what): print 'remind working' print def test(sender,kw): regex="remind me (to) (?p<reminder_text>.*?) (at|on|in) (?p<remind_time>.*)?" m=re.match(regex,kw['text'],re.dotall) if m: what=m.group("reminder_text") when=m.group("remind_time") when=nt.parse_natural_time(when) print when scheduler.print_jobs() scheduler.add_job(print_hello, 'date', name='testme', run_date=when,args=[what])`
the job executed @ time instant.
Comments
Post a Comment