I am experiencing that my job is executed twice when i remove a job from apsheduler and then add another job with same job id.
if sched.get_job(str(id)) is not None:
if schedule=='minutely':
sched.modify_job(str(id), lambda: seedset_harvest(id),id=str(id), trigger='cron', minute='*/1', start_date=s, end_date=e)
else:
if schedule=='minutely':
sched.add_job(lambda: seedset_harvest(id),id=str(id), trigger='cron', minute='*/1', start_date=s, end_date=e)
I am trying to schedule a job every minute here. If the job doesn't exists, i am able to schedule my job properly, but if it exists, the job is executed twice at each trigger(in this case at each minute) instead.
Here I am trying to check if a job with a given id exists, if it does then i am modifying it. I am using modify_job(id, **changes). Only in this case the job is executed twice.
I would appreciate if anyone can tell what's wrong with the code here.
Please let me know if the information i provided is insufficient here and i will edit my post.
NOTE: sched is my sheduler here.