1. import schedule
  2. import time
  3. import datetime
  4. def exploratory_task(timestamp):
  5. """
  6. Placeholder for your exploratory work. Replace with your actual code.
  7. """
  8. now = datetime.datetime.now()
  9. print(f"Running exploratory task at: {now}")
  10. print(f"Timestamp: {timestamp}")
  11. # Add your exploratory code here
  12. def schedule_tasks():
  13. """
  14. Schedules exploratory tasks with hard-coded limits.
  15. """
  16. # Define task schedules (timestamp, task name)
  17. tasks = {
  18. "task1": [
  19. datetime.datetime(2024, 1, 27, 10, 0, 0), # Year, Month, Day, Hour, Minute, Second
  20. datetime.datetime(2024, 1, 27, 14, 0, 0),
  21. datetime.datetime(2024, 1, 28, 10, 0, 0)
  22. ],
  23. "task2": [
  24. datetime.datetime(2024, 1, 27, 11, 30, 0),
  25. datetime.datetime(2024, 1, 28, 11, 30, 0),
  26. datetime.datetime(2024, 1, 29, 11, 30, 0)
  27. ],
  28. "task3": [
  29. datetime.datetime(2024, 1, 27, 15, 0, 0)
  30. ]
  31. }
  32. for task_name, timestamps in tasks.items():
  33. for timestamp in timestamps:
  34. schedule.every().day.at(timestamp.strftime("%H:%M:%S")).do(exploratory_task, timestamp)
  35. while True:
  36. schedule.run_pending()
  37. time.sleep(1)
  38. if __name__ == "__main__":
  39. schedule_tasks()

Add your comment