我有一个scheduler_project.py
脚本文件
代码:
from apscheduler.schedulers.background import BackgroundScheduler
scheduler = BackgroundScheduler()
def func_1():
# updating file-1
def func_2():
# updating file-2
scheduler.add_job(func_1, 'cron', hour='10-23' , minute='0-58', second=20)
scheduler.add_job(func_2, 'cron', hour='1')
scheduler.start()
当我运行时,(在Windows机器上)
E:\> python scheduler_project.py
E:\> # there is no error
在日志中:(我已经在调试级别的上述代码中添加了logging
)
It says, job is added and starts in (some x seconds), but it is not starting.
在任务管理器中,命令提示符进程会显示一秒钟,然后消失
我的文件也没有更新,这是显而易见的
发生什么事了?执行此调度程序脚本的正确方法是什么
调度器被创建为与其他代码一起运行-所以在启动调度器之后,您可以运行其他代码
如果你没有任何其他的工作,那么你必须使用一些循环来运行它的所有时间
在documentation中,您可以看到GitHub和one of example使用的示例的链接
相关问题 更多 >
编程相关推荐