简体   繁体   中英

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.

Note: I am using jupyter notebook

Thanks

APScheduler程序包具有灵活的作业计划(例如,每分钟运行一次,每个星期一的14:00运行,等等),并且可以运行多个作业。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM