Create Schedule
Summary
The CREATE SCHEDULE
command creates a schedule domain object. Schedules allow developers to automatically run steps and pipelines at specified times.
Syntax
create schedule [ if not exists] <schedule_name> as ([parameter_list]); |
Parameters
Parameter
|
Parameter List
|
Description
|
---|---|---|
[if not exists] |
(Optional) Create the schedule only if the schedule does not currently exist (the schedule has not already been created). | |
<schedule_name> |
The name of the schedule. | |
[parameter_list] |
("Pipeline"|"Step")=<name> |
The name of the pipeline or step to run at the scheduled time. If thePipeline parameter is specified, the Step parameter is ignored. |
Cron='cron string' |
A Quartz cron string expression with a maximum granularity of 1 hour.
The cron expression has 5 placeholders:
A cron string expression with a maximum granularity of 1 hour. In other words, you may schedule a job to run once an hour at the most. Connect does not support second or minute intervals. You can use the cron expression to tell which hour of the day you want the schedule to fire. When you create or alter the schedule domain object with a specified hour, Connect will randomly assign the schedule to one of the following minute buckets: hour:00, hour:10, hour:20 , hour:30, hour:40, hour:50. Once set, the schedule will always fire at the assigned time, unless the schedule object is in a suspended state. Refer to Cron maker offers a useful utility for generating cron expressions. Remember, to only include the 5 expression placeholders supported in Connect. |
|
Condition=<expression> |
(Optional) An XSQL logical expression that evaluates totrue or false . The scheduled step or pipeline will fire if the expression evaluates to true . If false , the scheduled step or pipeline will not execute for the given schedule invocation. Default is true . |
|
Retries=<integer> |
(Optional) When the Condition parameter evaluates to false , specifies how many times to retry before proceeding to the OnConditionFalse step. |
|
RetryInterval=<retry interval in minutes> |
(Optional) The number of minutes between each condition retry evaluation. | |
OnConditionFalse=<name of step to execute when condition fails> |
(Optional) The name of the step to execute if the condition evaluates to false after all retries. |
Details
The command creates the schedule in an active state. Use SUSPEND SCHEDULE
to temporarily disable a schedule.
Currently, only steps and pipelines can be scheduled.
You can specify the Retries
, RetryInterval
, and OnConditionFalse
parameters in cases when a condition is specified (otherwise, the parameters are ignored). Similarly, if the Retries
parameter is not specified, the RetryInterval
is ignored.
If the condition is false, the condition is rechecked after the number of minutes specified in the RetryInterval
parameter (for the number of times specified in the Retries
parameter). If, after the specified number of retries, the condition is still false, the command specified in theOnConditionFalse
parameter is run.
Examples
// Schedule created to run the step s1 every day at 2am create schedule if not exists sch_payee_csv as ( "Step" =s_create_payee_extract, "Cron" = '2 1/1 * ? *' ); // Example uses all available parameters. Schedule will fire every hour unless another instance of the p_triggers_monthly pipeline is already executing. v_order_upload_completed is a custom variable set to true or false by an earlier process. create schedule if not exists sch_p_triggers_monthly as ( "Pipeline" = p_triggers_monthly, Cron = '0/1 1/1 * ? *' , Condition = (:v_order_upload_completed), Retries = 0 , RetryInterval = 0 , OnConditionFalse = s_email_upload_orders_failed); |
Related Commands