本文整理汇总了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()