Skip to main content

@trigger

Use the @trigger decorator to trigger a flow deployed on Argo Workflows based on an external event.

Read more in Triggering Flows Based on External Events.

@trigger(...)

[source]

from metaflow import trigger

Specifies the event(s) that this flow depends on.

@trigger(event='foo')

or

@trigger(events=['foo', 'bar'])

Additionally, you can specify the parameter mappings to map event payload to Metaflow parameters for the flow.

@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})

or

@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
                 {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])

'parameters' can also be a list of strings and tuples like so:

@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})

This is equivalent to:

@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
Parameters 

event: Union[str, Dict[str, Any]], optional, default None

Event dependency for this flow.

events: List[Union[str, Dict[str, Any]]], default []

Events dependency for this flow.

options: Dict[str, Any], default {}

Backend-specific configuration for tuning eventing behavior.