Skip to content

Commit

Permalink
Merge pull request #123 from 23wh1a0513/patch-6
Browse files Browse the repository at this point in the history
Create Schedule _Run_Task
  • Loading branch information
suryanshsk authored Oct 10, 2024
2 parents ca93306 + c3facf6 commit c9b7309
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Schedule _Run_Task
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Task Scheduler Implementation (task_scheduler.py)

# List of tasks with their maximum permitted runtimes (in hours) and corresponding commands
task_list = [
{"task_name": "Task1", "max_hours": 3, "cmd": r"python task1_script.py"},
{"task_name": "Task2", "max_hours": 6, "cmd": r"python task2_script.py"},
# You can add additional tasks to this list as required
]

# Schedule the tasks
for item in task_list:
schedule.every().minute.do(run_task, item["task_name"], item["max_hours"], item["cmd"])

# Infinite loop to keep the scheduler running
while True:
schedule.run_pending() # Execute any pending tasks
time.sleep(1) # Pause for a second between checks

0 comments on commit c9b7309

Please sign in to comment.