次の発火がトリガーされたときに前のジョブが完了していないため、失火を与えることになっている簡単なコードがあります。
このプログラムでは、3 秒後に hello world を出力するつもりだったので、ミスファイアを作成するために、ジョブを 3 秒以上スリープさせて、前のジョブが完了しないようにしました。ただし、失火エラーは発生しません。私は混乱しています。
#!/usr/bin/env python
import sys
from time import sleep
from apscheduler.scheduler import Scheduler
sched = Scheduler()
sched.start() # start the scheduler
# define the function that is to be executed
# it will be executed in a thread by the scheduler
def my_job():
print "hello world"
sleep(10)
print "nest"
def main():
# job = sched.add_date_job(my_job, datetime(2013, 8, 5, 23, 47, 5), ['text'])
job = sched.add_interval_job(my_job,seconds=3)
while True:
sleep(1)
sys.stdout.write('.'); sys.stdout.flush()
##############################################################
if __name__ == "__main__":
main()
さらに、ジョブ "xxxxx の実行時間を生成する方法はありますか (トリガー: cron[日 ='*'、時間 ='0'、分 ='0'、秒 ='0']、次の実行: 2015-05 -14 00:00:00)" を 0:00:02.493426 で見逃したので、プログラムで合体をテストできますか?