Schedules and triggers
Configure triggers in code
Schedules and triggers
Configure triggers in code
Configure triggers in triggers.yaml under pipeline folder.
In addition to configurint triggers via UI, you can also configure triggers in code.
Create and configure triggers
Here are the steps to create and configure triggers via code:
- Create a
triggers.yaml
file under your pipeline folder. The file path should bepipelines/[pipeline_uuid]/triggers.yaml
. - Enter your trigger configs into the
triggers.yaml
file.- Content structure
triggers: - name: test_trigger schedule_type: time start_time: 2023-01-01 status: active - name: xxx ... - name: xxx ...
- Required trigger fields
name
: Unique identifier of the triggerschedule_type
:time
,api
, orevent
schedule_interval
:@once
,@hourly
, “@daily”,@weekly
,@monthly
, or Cron syntax(* * * * *
)start_time
: The start time of the trigger (e.g.2023-01-01
)
- Optional trigger fields
status
:active
orinactive
variables
: A dictionary of variables that’s associated with the triggersla
: SLA in secondssettings
: a dictionary of advanced settingsskip_if_previous_running
:true
/false
allow_blocks_to_fail
:true
/false
envs
: The environments that the trigger runs in. If envs is not set or empty, the trigger will run in all environments.
- Content structure
- Save the
triggers.yaml
file. The trigger configs will be synced to the triggers UI shortly.
Example triggers config:
triggers:
- name: test_example_trigger
schedule_type: time
schedule_interval: "@daily"
start_time: 2023-01-01
status: active
- name: test_example_trigger_2
schedule_type: time
schedule_interval: "@hourly"
start_time: 2023-03-01
status: inactive
- name: test_example_trigger_with_extra_settings
schedule_type: time
schedule_interval: "@hourly"
start_time: 2023-03-01
status: inactive
settings:
skip_if_previous_running: true
allow_blocks_to_fail: true
envs:
- prod
- dev
Modify triggers
For triggers that are configured in yaml file, any trigger settings made through UI will be overriden by the config from yaml file. Thus, to modify the trigger settings, you’ll need to update the trigger configs in yaml file directly. The new trigger configs will be automatically synced to the triggers in UI.
Delete triggers
If you don’t want to use a trigger anymore, you can either update the trigger status to inactive
or
delete the trigger completely.
To delete the trigger completely, you’ll need to remove the trigger config from the yaml file first and then delete the trigger from the UI.