File size: 668 Bytes
da3b15a
 
 
 
 
9b36cb7
 
 
da3b15a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9b36cb7
 
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
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()