How to automatically trigger a workflow

It is possible to create a dag that automatically triggers other dags. We use this functionality when processing incoming dicom files. But there are many more possible usecases. Take a look at the Existing Operators for implementation details.

LocalAutoTriggerOperator

The LocalAutoTriggerOperator scans the directory /home/kaapana/workflows/dags for files with the extension *trigger_rule.json, e.g. dag_service_extract_metadata_trigger_rule.json.

Example:

dag_service_extract_metadata_trigger_rule.json
[
 {
     "search_tags": {},
     "dag_ids": {
         "service-extract-metadata": {
             "fetch_method": "copy",
             "single_execution" : false
         }
     }
 }
]
  • Specify specifc DICOM tags as search_tags if desired

  • Define the dag id to trigger (<dag id to trigger>)

  • Set the fetch_method (e.g. copy data from current dag), else the data will be pulled from the packages

  • If it is a batch, to trigger the workflow in single or batch mode.

LocalDagTriggerOperator

To trigger a single workflow the operator LocalDagTriggerOperator with all it’s defined paramenters can be used.