[英]Running a script continuously while schedule the other
I have two scripts that I would like to run simultaneously. 我有两个脚本希望同时运行。 While one will be scheduled to run every minute, I would like the second to continuously run. 虽然计划每分钟运行一次,但我希望第二分钟连续运行。
I also would like both to run according to a schedule. 我也希望两者都按照时间表运行。 This is what I have so far: 这是我到目前为止的内容:
import numpy as np
import time
import schedule
import time
def job():
starttime=time.time() #runs every minute with 1 minute sleep
while True:
%run "script_1.py"
time.sleep(60.0 - ((time.time() - starttime) % 60.0))
schedule.every().monday.at("14:00").do(job)
while True:
schedule.run_pending()
time.sleep(1)
I need to squeeze script_2 in this script and make it run continuously within this schedule. 我需要在此脚本中压缩script_2,并使其在此计划内连续运行。
Note: I am using jupyter notebook 注意:我正在使用jupyter笔记本
Thanks 谢谢
APScheduler程序包具有灵活的作业计划(例如,每分钟运行一次,每个星期一的14:00运行,等等),并且可以运行多个作业。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.