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:")
想要在任务完成后结束计划程序,但是即使到达结束日期,计划程序仍会继续运行。