简体   繁体   中英

How to stop python Apscheduler on some condition

Actually am learning python APScheduler in this am trying one example

d={'a':{'status':'n'},'b':{'status':'n'},'c':{'status':'y'}}

The scheduler what i added is like below

for k,v in d.items():
if d[k]['status']=='n':
    sched.add_interval_job(f,minutes=1)
    d[k]['status']='y'

But this scheduler starts every 1 minute and call function f ,how to stop scheduler calling this function, f if their are no entries in dict with status 'n' and how to continue this scheduler calling if their are entries with status 'n' in dict d.

您可以按照docs使用sched.unschedule_job(job_function.job)计划工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM