1

Trying to run some CLI on schedule like

create-job-once-a-day:
  hours: <DYNAMIC VALUE>
  minutes: <DYNAMIC VALUE>
  thread: true
  function: >
    logging.critical('HELLO')

Is It possible to take the DYNAMIC VALUES from dynamic sources like a file?

1 Answers1

1

One possibility is to run every minute, and check the time (or for any condition) in the function. For example:

create-job-once-a-day:
  hours: '*'
  minutes: '*'
  thread: true
  function: >
    mymodule.my_schedule_function()

In mymodule.py:

def my_schedule_function():
    if some_dynamic_condition_is_true():
        logging.critical('HELLO')
        # perform rest of the task

Schedules are quite efficient, so this won't impact the CPU.

S Anand
  • 11,364
  • 2
  • 28
  • 23