roboto.domain.actions.trigger
Module Contents
Trigger
A rule that automatically invokes an action when specific events or conditions occur.
Triggers enable automated data processing workflows by monitoring for specific events (like new datasets being created) and automatically invoking actions when conditions are met. They eliminate the need for manual intervention in routine data processing tasks.
Triggers can be configured to:
- Monitor for new datasets, files, or other data sources
- Apply conditional logic to determine when to execute
- Specify input data patterns and action parameters
- Override compute requirements and container parameters
- Execute actions for each matching item or in batch
A trigger consists of:
- Target action to invoke
- Input data requirements and patterns
- Execution conditions and causes
- Parameter values and overrides
- Scheduling and execution settings
Parameters
roboto_client Optional[roboto.Properties
Trigger.condition
Trigger.create()
Create a new trigger that automatically invokes an action when conditions are met.
Creates a trigger that monitors for specific events (like new datasets or files) and automatically invokes the specified action when the trigger conditions are satisfied. This enables automated data processing workflows.
Parameters
name strUnique name for the trigger within the organization.
action_name strName of the action to invoke when the trigger fires.
required_inputs list[str]List of file patterns that must be present for the trigger to fire. Uses glob patterns like “**/*.bag” or “data/*.csv”.
Granularity of execution - Dataset creates one invocation per dataset, DatasetFile creates one invocation per matching file.
enabled boolWhether the trigger should be active immediately after creation.
action_digest Optional[str]Specific version digest of the action to invoke. If not provided, uses the latest version.
action_owner_id Optional[str]Organization ID that owns the target action. If not provided, searches in the caller’s organization.
additional_inputs Optional[list[str]]Optional additional file patterns to include in invocations.
causes Optional[list[roboto.List of events that can cause this trigger to be evaluated. If not provided, uses default causes.
compute_requirement_overrides Optional[roboto.Optional compute requirement overrides for action invocations.
condition Optional[roboto.Optional condition that must be met for the trigger to fire. Can filter based on metadata, file properties, etc.
container_parameter_overrides Optional[roboto.Optional container parameter overrides for action invocations.
parameter_values Optional[dict[str, Any]]Parameter values to pass to the action when invoked.
service_user_id Optional[str]Optional service user ID for authentication.
timeout Optional[int]Optional timeout override for action invocations in minutes.
caller_org_id Optional[str]Organization ID to create the trigger in. Defaults to caller’s org.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Returns
The newly created Trigger instance.
Raises
If the trigger configuration is invalid.
If the request is malformed.
If the caller lacks permission to create triggers.
Usage
Create a simple trigger for ROS bag files:
from roboto.domain.actions import Trigger, TriggerForEachPrimitive
trigger = Trigger.create(
name="auto_process_bags",
action_name="ros_ingestion",
required_inputs=["**/*.bag"],
for_each=TriggerForEachPrimitive.Dataset,
)Create a conditional trigger with parameters:
from roboto.query import Condition
condition = Condition("metadata.sensor_type").equals("lidar")
trigger = Trigger.create(
name="lidar_processing",
action_name="lidar_processor",
required_inputs=["**/*.pcd"],
for_each=TriggerForEachPrimitive.Dataset,
condition=condition,
parameter_values={"resolution": "high", "filter": "statistical"},
)Create a trigger with compute overrides:
from roboto.domain.actions import ComputeRequirements
trigger = Trigger.create(
name="heavy_processing",
action_name="ml_inference",
required_inputs=["**/*.jpg", "**/*.png"],
for_each=TriggerForEachPrimitive.DatasetFile,
compute_requirement_overrides=ComputeRequirements(vCPU=8192, memory=16384),
)Trigger.delete()
Trigger.disable()
Trigger.enable()
Properties
Trigger.for_each
Trigger.from_name()
Parameters
Return type
Trigger.get_action()
Return type
Trigger.get_evaluations()
Parameters
limit Optional[int]page_token Optional[str]Return type
Trigger.get_evaluations_for_dataset()
Get all trigger evaluations for a specific dataset.
Retrieves the history of trigger evaluations that were performed for a given dataset, including successful invocations and failed attempts.
Parameters
dataset_id strThe ID of the dataset to get evaluations for.
owner_org_id Optional[str]Organization ID that owns the dataset. If not provided, searches in the caller’s organization.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Yields
TriggerEvaluationRecord instances for the dataset.
Raises
If the dataset is not found.
If the caller lacks permission to access evaluations.
Return type
Usage
Get all evaluations for a dataset:
for evaluation in Trigger.get_evaluations_for_dataset("ds_12345"):
print(f"Trigger: {evaluation.trigger_name}, Status: {evaluation.status}")Check if any triggers succeeded for a dataset:
from roboto.domain.actions import TriggerEvaluationStatus
evaluations = list(Trigger.get_evaluations_for_dataset("ds_12345"))
successful = [e for e in evaluations if e.status == TriggerEvaluationStatus.Succeeded]
print(f"Found {len(successful)} successful trigger evaluations")Trigger.get_invocations()
Return type
Trigger.invoke()
Parameters
idempotency_id Optional[str]input_data_override Optional[list[str]]upload_destination Optional[roboto.Return type
Trigger.latest_evaluation()
Return type
Trigger.query()
Parameters
spec Optional[roboto.owner_org_id Optional[str]roboto_client Optional[roboto.Return type
Properties
Trigger.record
Trigger.to_dict()
Return type
Properties
Trigger.update()
Parameters
action_name Union[str, roboto.action_owner_id Union[str, roboto.action_digest Optional[Union[str, roboto.additional_inputs Optional[Union[list[str], roboto.causes Union[list[roboto.compute_requirement_overrides Optional[Union[roboto.container_parameter_overrides Optional[Union[roboto.condition Optional[Union[roboto.enabled Union[bool, roboto.parameter_values Optional[Union[dict[str, Any], roboto.required_inputs Union[list[str], roboto.timeout Optional[Union[int, roboto.Return type
Trigger.wait_for_evaluations_to_complete()
Wait for all evaluations for this trigger to complete.
Throws a TimeoutError if the timeout is reached.
Parameters
timeout floatThe maximum amount of time, in seconds, to wait for the evaluations to complete.
poll_interval roboto.The amount of time, in seconds, to wait between polling iterations.
Return type