Skip to content

Scheduler

Cron parsing, delay, and interval calculations.

3 modules

ModuleDescription
Parse Cron ExpressionParse cron expression and calculate next N run times
Delay / SleepPause execution for a specified duration
Calculate IntervalCalculate interval timing and next occurrences

Modules

Parse Cron Expression

scheduler.cron_parse

Parse cron expression and calculate next N run times

Parameters:

NameTypeRequiredDefaultDescription
expressionstringYes-Standard 5-field cron expression (e.g. "0 9 * * MON-FRI")
countnumberNo5Number of next run times to calculate
timezonestringNo0Timezone for calculation (UTC offset like "+8" or "-5", default "0" for UTC)

Output:

FieldTypeDescription
expressionstringThe parsed cron expression
descriptionstringHuman-readable description of the schedule
next_runsarrayList of next run times as ISO datetime strings
is_validbooleanWhether the expression is valid

Delay / Sleep

scheduler.delay

Pause execution for a specified duration

Parameters:

NameTypeRequiredDefaultDescription
secondsnumberYes-Number of seconds to delay
messagestringNo-Optional message to include in the result

Output:

FieldTypeDescription
delayed_secondsnumberActual number of seconds delayed
messagestringThe provided message or default

Calculate Interval

scheduler.interval

Calculate interval timing and next occurrences

Parameters:

NameTypeRequiredDefaultDescription
secondsnumberNo0Interval seconds component
minutesnumberNo0Interval minutes component
hoursnumberNo0Interval hours component
start_timestringNo-Start time in ISO 8601 format (default: now)

Output:

FieldTypeDescription
interval_secondsnumberTotal interval in seconds
next_runsarrayList of next 5 run times as ISO datetime strings
human_readablestringHuman-readable interval description

Released under the Apache 2.0 License.