print('hi apscheduler')
def job_task():
print("Hello ...{}".format(datetime.now()))
sched = BlockingScheduler()
print("adding new job:")
job_id = sched.add_job(job_task, 'interval', minutes=1, start_date='2018-08-30 16:16:00',
end_date='2018-08-30 16:18:00', id='my_job_id')
print("added new job to scheduler")
print(job_id)
res = sched.start()
print(res)
print(sched.job_ids())
sched.remove_job('my_job_id')
print("my_job_id job removed")
sched.shutdown()
print(" shutng down the scheduler:")
想要在任务完成后结束调度程序,但调度程序即使在达到结束日期后也会继续运行。
得到了答案。使用了错误类型的调度程序。有关更多详细信息,请点击此链接python apscheduler not shutting down