File size: 688 Bytes
da3b15a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import os
import subprocess
from apscheduler.schedulers.blocking import BackgroundScheduler
def run_command(command, shell=True):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell)
stdout, stderr = process.communicate()
if process.returncode == 0:
print("Command executed successfully")
print(stdout.decode())
else:
print("Command failed")
print(stderr.decode())
def run_benchmark():
run_command("python run_benchmark.py")
scheduler = BackgroundScheduler()
scheduler.add_job(
run_benchmark,
'cron',
day_of_week='sun',
hour=0,
timezone='UTC')
scheduler.start() |