如何使用 schedule 包准确地将 python 作业安排到 运行 每小时

How to schedule python job to run every hour accurately with the schedule package

我正在使用时间表 python 包,并希望在每小时 :00 标记 运行 一个作业。

这可能吗?

这是我现在拥有的代码:

def schedule_jobs(self, loop):
    logging.info('Starting scheduler...')

    schedule.every(1).hours.do(self._pldown_runner.run_pldown_job, loop)

    while True:
        schedule.run_pending()
        time.sleep(1)

问题在于,从实际执行的那一刻起,每小时 运行 执行一次作业。

时间表api支持:

schedule.every().hour.at(":00").do(my_job)