TriggerPluginV1

toloka.client.project.template_builder.plugins.TriggerPluginV1 | Source code

TriggerPluginV1(
self,
*,
action: Optional[BaseComponent] = None,
condition: Optional[BaseComponent] = None,
fire_immediately: Optional[Union[BaseComponent, bool]] = None,
on_change_of: Optional[BaseComponent] = None,
version: Optional[str] = '1.0.0'
)

Use this to configure triggers that trigger a specific action when an event occurs.

The action is set in the action property, and the event is described in the other fields.

The event can be triggered immediately when the task is loaded ("fireImmediately": true) or when data changes in the property specified in onChangeOf.

You can also set conditions in the conditions property that must be met in order for the trigger to fire.

Parameters Description

ParametersTypeDescription
actionOptional[BaseComponent]

The action to perform when the trigger fires.

conditionOptional[BaseComponent]

The condition that must be met in order to fire the trigger.

fire_immediatelyOptional[Union[BaseComponent, bool]]

Flag indicating whether the trigger should be fired immediately after the task is loaded.

on_change_ofOptional[BaseComponent]

The data that triggers the action when changed.

Examples:

How to save Toloker's coordinates to the output.

coordinates_save_plugin = tb.plugins.TriggerPluginV1(
fire_immediately=True,
action=tb.actions.SetActionV1(
data=tb.data.OutputData(path='performer_coordinates'),
payload=tb.data.LocationData()
),
)
Toloka-Kit
OverviewGetting OAuth tokenQuick start
Recipes
Reference
toloka.client
toloka.async_client
toloka.autoquality [autoquality]
toloka.metrics
toloka.streaming