1

为什么作业没有触发?

我想在每天 01:00:00 触发工作。

如果我将触发时间设置为上午 10 点并运行 py 脚本。它会起作用的。但在凌晨 1 点,没有触发。

调用 print_jobs(),

Jobstore default:

    grab_star_baidu_news (trigger: cron[hour='1', minute='0', second='0'], next run at: 2014-02-26 01:00:00)

    grab_star_baidu_news_title (trigger: cron[hour='1', minute='30', second='0'], next run at: 2014-02-26 01:30:00)

    film_info_2_db (trigger: cron[hour='3', minute='0', second='0'], next run at: 2014-02-26 03:00:00)

我的脚本是这样的(在 windows server 2012 上运行):

 from apscheduler.scheduler import Scheduler
 import apscheduler
 import sys

 sys.path.append("E:\data")
 sch = Scheduler(daemonic=False)

 @sch.cron_schedule(hour="1", minute="0", second="0")
 def grab_star_baidu_news():
     import BaiduNewsMx
     BaiduNewsMx.GrabMxBaiduNews()


 @sch.cron_schedule(hour="1", minute="30", second="0")
 def grab_star_baidu_news_title():
     import BaiduNewsTitleMx
     BaiduNewsTitleMx.GrabBaiduMxNewsTitle()

 @sch.cron_schedule(hour="3", minute="0", second="0")
 def film_info_2_db():
     import InfoToDb
     InfoToDb.InsertFilmInfo2Db()

 #Job listener for completed and miss.
 def job_listener(ev):
     if ev.exception:
         print(str(ev.exception))
     else:
         print(str(ev.job))


 def job_complete(ev):
     #print('%s completed!', str(ev.job))
     sch.print_jobs()


 sch.add_listener(job_complete, apscheduler.events.EVENT_JOB_EXECUTED)
 sch.start()
 print("Schedule started.")
 sch.print_jobs()
4

0 回答 0