本文整理匯總了Python中apscheduler.job.Job.resume方法的典型用法代碼示例。如果您正苦於以下問題:Python Job.resume方法的具體用法?Python Job.resume怎麽用?Python Job.resume使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類apscheduler.job.Job
的用法示例。
在下文中一共展示了Job.resume方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _update_scheduler_status
# 需要導入模塊: from apscheduler.job import Job [as 別名]
# 或者: from apscheduler.job.Job import resume [as 別名]
def _update_scheduler_status(scheduler, config):
now = datetime.now()
working_hours = parse_working_hours(config)
jobs = scheduler.get_jobs()
work = False
for start, end in working_hours:
if start <= (now.hour * 60 + now.minute) <= end:
work = True
if not work:
for j in jobs:
if j.name == 'partial' and \
j.func.func.__name__ in excluded_job_names:
continue
j.pause()
else:
# slack post message limit
for job_id, times_ in g.items():
if times_ > config.max_alert - 1:
job = Job(scheduler, job_id)
job.pause()
stoped[job_id] = (job, now)
g[job_id] = 0
for job_id in list(stoped):
job, time_ = stoped[job_id]
if time_ + timedelta(minutes=config.pause_time) <= now:
job.resume()
del stoped[job_id]
for j in jobs:
if j.name == 'partial' and \
j.func.func.__name__ in excluded_job_names:
continue
if j.id not in stoped:
j.resume()