Pipeline Trigger
  • 29 Jul 2024
  • Dark
    Light
  • PDF

Pipeline Trigger

  • Dark
    Light
  • PDF

Article summary

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.

Note that you can only use one resource per trigger, while multiple actions can be defined for that resource.
dl EnumAPI ValueDataloop EntityAvailable Actions (*) 
dl.TriggerResource.ITEMItemPlatform itemCreated,Updated,Deleted,Clone
dl.TriggerResource.DATASETDatasetPlatform datasetCreated,Updated,Deleted
dl.TriggerResource.ANNOTATIONAnnotationPlatform item's annotationCreated,Updated,Deleted
dl.TriggerResource.ITEM_STATUSItemStatusPlatform Item's statusUpdated**, taskAssigned
dl.TriggerResource.TASKTaskPlatform taskCreated,Updated,Deleted,statusChanged
dl.TriggerResource.ASSIGNMENTAssignmentPlatform assignmentCreated,Updated,Deleted,statusChanged
dl.TriggerResource.MODEL
ModelPlatform ModelCreated,Updated,Deleted


(*) Your pipeline can be triggered by the following actions when taken over a resource (a specific resource must be set!):

  1. Created: run the pipeline on any newly created items (uploaded or synced to a Dataset).
  2. Update: run the pipeline on any updated item. See (**) for more details regarding "itemStatus.Updated".
  3. Deleted: run the pipeline on any deleted item.
  4. Clone: run the pipeline on items created by a 'clone' operation.
  5. 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".
  6. 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 EnumAPI ValueAvailable Modes
1dl.TriggerAction.CREATEDCreatedOnce
2dl.TriggerAction.UPDATEDUpdatedOnce, Always
3dl.TriggerAction.DELETEDDeletedOnce
4dl.TriggerAction.CLONECloneOnce
5dl.TriggerAction.STATUS_CHANGEDstatusChangedOnce, Always
6dl.TriggerAction.TASK_ASSIGNEDtaskAssignedOnce, 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 Enumdl.TriggerExecutionMode.ONCE
dl.TriggerExecutionMode.ONCEOnce
dl.TriggerExecutionMode.ALWAYSAlways

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. 
The pipeline will be triggered again and again when implementing the above pipelines.



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).


Please note: at the moment, you cannot keep cron triggers active when the pipeline is paused.


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.  

Pipeline settings
Each pipeline has its own settings. By setting your required behavior you won't affect any of your available pipeline


Update Pipeline Settings: On pause action 

To change the pipeline settings:

  1. Pipeline header > 3 dots > Settings
  2. The pipeline Settings dialog will open
  3. 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.