tron.config.schedule_parse module

Parse and validate scheduler configuration and return immutable structures.

class tron.config.schedule_parse.ConfigCronScheduler(original, minutes, hours, monthdays, months, weekdays, ordinals, jitter)

Bases: tuple

hours

Alias for field number 2

jitter

Alias for field number 7

minutes

Alias for field number 1

monthdays

Alias for field number 3

months

Alias for field number 4

ordinals

Alias for field number 6

original

Alias for field number 0

weekdays

Alias for field number 5

class tron.config.schedule_parse.ConfigDailyScheduler(original, hour, minute, second, days, jitter)

Bases: tuple

days

Alias for field number 4

hour

Alias for field number 1

jitter

Alias for field number 5

minute

Alias for field number 2

original

Alias for field number 0

second

Alias for field number 3

class tron.config.schedule_parse.ConfigGrocScheduler(original, ordinals, weekdays, monthdays, months, timestr, jitter)

Bases: tuple

jitter

Alias for field number 6

monthdays

Alias for field number 3

months

Alias for field number 4

ordinals

Alias for field number 1

original

Alias for field number 0

timestr

Alias for field number 5

weekdays

Alias for field number 2

exception tron.config.schedule_parse.ScheduleParseError

Bases: ConfigError

class tron.config.schedule_parse.ScheduleValidator

Bases: Validator

Validate the structure of a scheduler config.

config_class

alias of ConfigGenericSchedule

defaults = {'jitter': datetime.timedelta(0)}
validators = {'jitter': <function valid_time_delta>, 'type': <function build_type_validator.<locals>.f>}
tron.config.schedule_parse.build_groc_schedule_parser_re()

Build a regular expression that matches this:

(“every”|ordinal) (day) [“of|in” (monthspec)] ([“at”] HH:MM)

ordinal - comma-separated list of “1st” and so forth days - comma-separated list of days of the week (for example,

“mon”, “tuesday”, with both short and long forms being accepted); “every day” is equivalent to “every mon,tue,wed,thu,fri,sat,sun”

monthspec - comma-separated list of month names (for example,

“jan”, “march”, “sep”). If omitted, implies every month. You can also say “month” to mean every month, as in “1,8th,15,22nd of month 09:00”.

HH:MM - time of day in 24 hour time.

This is a slightly more permissive version of Google App Engine’s schedule parser, documented here: http://code.google.com/appengine/docs/python/config/cron.html#The_Schedule_Format

tron.config.schedule_parse.day_canonicalization_map()

Build a map of weekday synonym to int index 0-6 inclusive.

tron.config.schedule_parse.month_canonicalization_map()

Build a map of month synonym to int index 0-11 inclusive.

tron.config.schedule_parse.normalize_weekdays(seq)
tron.config.schedule_parse.pad_sequence(seq, size, padding=None)

Force a sequence to size. Pad with padding if too short, and ignore extra pieces if too long.

tron.config.schedule_parse.parse_groc_expression(config, config_context)

Given an expression of the form in the docstring of daily_schedule_parser_re(), return the parsed values in a ConfigGrocScheduler

tron.config.schedule_parse.schedule_config_from_legacy_dict(schedule, config_context)

Support old style schedules as dicts.

tron.config.schedule_parse.schedule_config_from_string(schedule, config_context)

Return a scheduler config object from a string.

tron.config.schedule_parse.valid_cron_scheduler(config, config_context)

Parse a cron schedule.

tron.config.schedule_parse.valid_daily_scheduler(config, config_context)

Daily scheduler, accepts a time of day and an optional list of days.

tron.config.schedule_parse.valid_schedule(schedule, config_context)
tron.config.schedule_parse.validate_generic_schedule_config(config, config_context)