This part covers some interfaces of Plan.
The central object where you register jobs. One Plan instance should manage a group of jobs.
Parameters: |
|
---|
Register bootstrap commands.
Parameters: | command_or_commands – One command or a list of commands. |
---|
Register one command.
Comment begin content for this object, this will be added before the actual cron syntax jobs content. Different name is used to distinguish different Plan object, so we can locate the cronfile content corresponding to this object.
Your schedule jobs converted to cron syntax.
Return a list of registered jobs’s cron syntax content.
Register one module.
Register one raw job.
Get the current working crontab cronfile content.
Use this to do any action on this Plan object.
Parameters: | run_type – The running type, one of (“check”, “write”, “update”, “clear”), default to be “check” |
---|
Run bootstrap commands.
Register one script.
Update the current cronfile, used by run_type update or clear. This will find the block inside cronfile corresponding to this Plan object and replace it.
Parameters: | update_type – update or clear, if you choose update, the block corresponding to this plan object will be replaced with the new cron job entries, otherwise, they will be wiped. |
---|
Write the crontab cronfile with this object’s cron content, used by run_type write. This will replace the whole cronfile.
The plan job base class.
Parameters: |
|
---|
Job in cron syntax.
The main job template.
Parse at value into (at_type, moment) pairs.
Parse every value.
Returns: | every_type. |
---|
Parses month into month numbers. Month can only occur in every value.
Parameters: | month – this parameter can be the following values: jan feb mar apr may jun jul aug sep oct nov dec and all of those full month names(case insenstive) or <int:n>.month |
---|
Parse every and at into cron time syntax:
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └─── day of week (0 - 7) (0 to 6 are Sunday to Saturday)
# │ │ │ └───── month (1 - 12)
# │ │ └─────── day of month (1 - 31)
# │ └───────── hour (0 - 23)
# └─────────── minute (0 - 59)
Parses day of week name into week numbers.
Parameters: | week – this parameter can be the following values: sun mon tue wed thu fri sat sunday monday tuesday wednesday thursday friday saturday weekday weedend(case insenstive) |
---|
Do preprocess for at value, just modify “12:12” style moment into “hour.12 minute.12” style moment value.
Parameters: | at – The at value you want to do preprocess. |
---|
Process template content. Drop multiple spaces in a row and strip it.
Translate frequency into comma separated times.
Cron content task part.
The task template. You should implement this in your own job type. The default template is:
'cd {path} && {environment} {task} {output}'
Cron content time part.
Validate every and at value.
every can be:
[1-60].minute [1-24].hour [1-31].day
[1-12].month [1].year
jan feb mar apr may jun jul aug sep oct nov dec
sun mon tue wed thu fri sat weekday weekend
or any fullname of month names and day of week names
(case insensitive)
at:
when every is minute, can not be set
when every is hour, can be minute.[0-59]
when every is day of month, can be minute.[0-59], hour.[0-23]
when every is month, can be day.[1-31], day of week,
minute.[0-59], hour.[0-23]
when every is day of week, can be minute.[0-59], hour.[0-23]
at can also be multiple at values seperated by one space.
The command job.
Template:
'{task} {output}'
The script job.
Template:
'cd {path} && {environment} %s {task} {output}' % sys.executable