SchedEx (SchedEx v1.1.4) View Source
SchedEx schedules jobs (either an m,f,a or a function) to run in the future. These jobs are run in isolated processes, and are unsurpervised.
Link to this section Summary
Functions
Cancels the given scheduled job
Runs the given function at the given time
Runs the given module, function and argument at the given time
Runs the given function on every occurrence of the given crontab. If func is of arity 1, the scheduled execution time will be passed for each invocation
Runs the given module, function and argument on every occurrence of the given crontab. Any
values in the arguments array which are equal to the magic symbol :sched_ex_scheduled_time
are replaced with the scheduled execution time for each invocation
Runs the given function in given number of units (this corresponds to milliseconds
unless a custom time_scale
is specified). If func is of arity 1, the scheduled
execution time will be passed for each invocation
Runs the given module, function and argument in given number of units (this
corresponds to milliseconds unless a custom time_scale
is specified). Any
values in the arguments array which are equal to the magic symbol :sched_ex_scheduled_time
are replaced with the scheduled execution time for each invocation
Returns stats on the given job. Stats are returned for
Link to this section Functions
Cancels the given scheduled job
Runs the given function at the given time
Runs the given module, function and argument at the given time
Runs the given function on every occurrence of the given crontab. If func is of arity 1, the scheduled execution time will be passed for each invocation
Takes the same options as run_every/5
Runs the given module, function and argument on every occurrence of the given crontab. Any
values in the arguments array which are equal to the magic symbol :sched_ex_scheduled_time
are replaced with the scheduled execution time for each invocation
Supports the following options:
timezone
: A string timezone identifier (America/Chicago
) specifying the timezone within which the crontab should be interpreted. If not specified, defaults toUTC
time_scale
: A module that implements theSchedEx.TimeScale
behaviour, by default is set toSchedEx.IdentityTimeScale
. Can be used to speed up time (often used for speeding up test runs)name
: To attach a name to the process. Useful for adding a name to Registry to lookup later. ie. {:via, Registry, {YourRegistryName, "scheduled-task-1"}}nonexistent_time_strategy
: How to handle scheduled runs within a DST forward boundary when evaluated within the timezone specified by thetimezone
option. Valid values are:skip
(the default) and:adjust
. By way of example, for a job which is scheduled to happen daily at 2:30am in theAmerica/Chicago
timezone, on days where a forward DST transition happens (such as 10 March 2019):skip
will skip this invocation and next run the job at 2:30 CDT 11 March 2019, while:adjust
will run the job the same amount of time into the day as it would normally run (2.5 hours after midnight, which will be at 3:30 CDT 10 March 2019).
Runs the given function in given number of units (this corresponds to milliseconds
unless a custom time_scale
is specified). If func is of arity 1, the scheduled
execution time will be passed for each invocation
Takes the same options as run_in/5
Runs the given module, function and argument in given number of units (this
corresponds to milliseconds unless a custom time_scale
is specified). Any
values in the arguments array which are equal to the magic symbol :sched_ex_scheduled_time
are replaced with the scheduled execution time for each invocation
Supports the following options:
repeat
: Whether or not this job should be recurringstart_time
: ADateTime
to use as the basis to offset fromtime_scale
: A module that implements theSchedEx.TimeScale
behaviour, by default is set toSchedEx.IdentityTimeScale
. Can be used to speed up time (often used for speeding up test runs)name
: To attach a name to the process. Useful for adding a name to Registry to lookup later. ie. {:via, Registry, {YourRegistryName, "scheduled-task-1"}}
Returns stats on the given job. Stats are returned for:
scheduling_delay
: The delay between when the job was scheduled to execute, and the time it actually was executed. Based on the quantized scheduled start, and so does not include quantization error. Value specified in microseconds.quantization_error
: Erlang is only capable of scheduling future calls with millisecond precision, so there is some inevitable precision lost between when the job would be scheduled in a perfect world, and how well Erlang is able to schedule the job (ie: to the closest millisecond). This error value captures that difference. Value specified in microseconds.execution_time
: The amount of time the job spent executing. Value specified in microseconds.