Spaces:
Runtime error
Runtime error
| 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() | |