- 29 Jul 2024
- Print
- DarkLight
- PDF
Pipeline Trigger
- Updated On 29 Jul 2024
- Print
- DarkLight
- PDF
The Dataloop Pipeline enables you to set one or more triggers to your pipeline, to automatically execute the pipeline flow in response to some events/on predefined times. When you bind a trigger to a pipeline, that pipeline will execute when the trigger fires.
Triggers can be defined with a time pattern (cron trigger) or by an event in the Dataloop system (event trigger).
The event-based trigger is related to a combination of resources and actions. A resource can be any entity in our system (item, dataset, annotation, etc.) and the associated action will define a change in the resource that will prompt the trigger (update, create, clone, etc.).
A DQL filter (Data Query Engine) can be set to filter out resources from the trigger.
Set Triggers in Pipeline
The resource object that triggers the pipeline will be passed as the pipeline’s input parameter and will trigger the entire pipeline flow.
A trigger can be defined on multiple pipeline nodes at once. When the trigger fires, each pipeline node with a set trigger will be invoked independently, including its subsequent flow.
- To read more about trigger statuses (active/inactive/created), click here.
- To read more about manual pipeline execution, click here.
Event Triggers - Resource
Events of which entities to listen to?
Resources are entities in the Dataloop system: Item, Annotation, Dataset, Task, etc. Each resource is associated with an action to define a specific event for the trigger.
Once an event trigger occurs, the resource object is delivered as an input for the execution created.
dl Enum | API Value | Dataloop Entity | Available Actions (*) |
---|---|---|---|
dl.TriggerResource.ITEM | Item | Platform item | Created,Updated,Deleted,Clone |
dl.TriggerResource.DATASET | Dataset | Platform dataset | Created,Updated,Deleted |
dl.TriggerResource.ANNOTATION | Annotation | Platform item's annotation | Created,Updated,Deleted |
dl.TriggerResource.ITEM_STATUS | ItemStatus | Platform Item's status | Updated**, taskAssigned |
dl.TriggerResource.TASK | Task | Platform task | Created,Updated,Deleted,statusChanged |
dl.TriggerResource.ASSIGNMENT | Assignment | Platform assignment | Created,Updated,Deleted,statusChanged |
dl.TriggerResource.MODEL | Model | Platform Model | Created,Updated,Deleted |
(*) Your pipeline can be triggered by the following actions when taken over a resource (a specific resource must be set!):
- Created: run the pipeline on any newly created items (uploaded or synced to a Dataset).
- Update: run the pipeline on any updated item. See (**) for more details regarding "itemStatus.Updated".
- Deleted: run the pipeline on any deleted item.
- Clone: run the pipeline on items created by a 'clone' operation.
- taskAssigned: once an item is assigned to a task, run the pipeline over this item. To use this event, set the following trigger: "ItemStatus.TaskAssigned".
- statusChanged: once a task/assignment status is changed, run the pipeline over this task/assignment (task 'completed', assignment 'done').
(**) Use the trigger "itemStatus.Updated" to run your pipeline over items once their status is changed within a task context ('approved', 'discard', etc.).
Event Triggers - Action
What event action types are available?
Actions are the events that will trigger the pipeline.
For further explanation regarding the actions, read the explanations above (*).
dl Enum | API Value | Available Modes | |
---|---|---|---|
1 | dl.TriggerAction.CREATED | Created | Once |
2 | dl.TriggerAction.UPDATED | Updated | Once, Always |
3 | dl.TriggerAction.DELETED | Deleted | Once |
4 | dl.TriggerAction.CLONE | Clone | Once |
5 | dl.TriggerAction.STATUS_CHANGED | statusChanged | Once, Always |
6 | dl.TriggerAction.TASK_ASSIGNED | taskAssigned | Once, Always |
Event Triggers - Execution Mode
Some events, such as item updates, can happen more than once on the same entity. Trigger execution mode defines those repeating events that will trigger the service every time they happen, or only on the first time they happen.
- Once - the pipeline will only run once when triggered over a resource. For instance, for an "item" resource and an "Updated" action, the pipeline will be executed only for the first update of an item.
- Always - the pipeline will run each time when triggered over a resource. For instance, for an "item" resource and an "Updated" action, the pipeline will run for every updated item. Note that in this case, it will cause the entire pipeline flow to run.
dl Enum | dl.TriggerExecutionMode.ONCE |
---|---|
dl.TriggerExecutionMode.ONCE | Once |
dl.TriggerExecutionMode.ALWAYS | Always |
Be careful not to loop an event trigger. Known examples:
- Creating a Pipeline that adds items to a folder, while an event trigger "item.created" is set for this pipeline.
- Creating a pipeline that updates items, while an event trigger "item.updated" with execution_mode='always' is set for this pipeline.
Trigger at Specified Time Patterns
Cron Expression
Dataloop Pipeline enables you to run your Pipelines at specified time patterns with constant input using the Cron syntax.
In the Cron trigger specification, you specify when you want the trigger to start and when you want it to end. The Cron spec specifies when it should run, and the input that should be sent to the action.
Cron: Cron spec specifies when it should run, more information at https://en.wikipedia.org/wiki/Cron.
Trigger Status
Created, Active, Inactive
Pipeline triggers have three available statuses: Created, Active, and Inactive.
When setting a new trigger on a pipeline node, it will get the status "Created". Once you start running your pipeline, the trigger will become "Active" by default.
Statuses are visible on the node (on Canvas).
Trigger Activation - Paused Pipeline
You are able to keep the pipeline's event triggers active when the pipeline is paused so you won't lose upcoming events (for example while editing your pipeline).
Any new event will be queued to the pipeline as a pending cycle. You can see the queued cycles in the pipeline statistic bar (visible in view mode only).
When pausing a running pipeline with set triggers (excluding cron triggers), a popup will appear with the options to keep pipeline triggers active or inactivate them.
You have the option to save your choice to the pipeline settings (via the "Don't ask again" checkbox), and the popup won't open again.
Update Pipeline Settings: On pause action
To change the pipeline settings:
- Pipeline header > 3 dots > Settings
- The pipeline Settings dialog will open
- Choose the required action from the dropdown list
Resuming Pipeline With active Triggers
Once resuming the pipeline is, all triggers will become active again, and in case there are any pending/paused cycles, a dialog will open, providing you with options to run/abort the pending cycle.
Please click here, to read more about resuming the pipeline with paused/pending cycles.