Reputation: 393
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
Upvotes: 0
Views: 458
Reputation: 370
The APScheduler package has flexible job scheduling (e.g. run every minute, run every monday at 14:00, etc) and it can run multiple jobs.
Upvotes: 1