roboto.domain.actions.scheduled_trigger#
Module Contents#
- class roboto.domain.actions.scheduled_trigger.ScheduledTrigger(record, roboto_client=None)#
A trigger that invokes actions on a recurring schedule, e.g. hourly or daily.
Schedules are currently specified using standard Cron expressions, with times in UTC. A handful of common schedules are provided by the
TriggerSchedule
class.Once a scheduled time is reached, the action associated with this trigger will be invoked using the optionally provided input specification, and any other overrides such as compute requirements or parameter values.
- Parameters:
record (roboto.domain.actions.scheduled_trigger_record.ScheduledTriggerRecord)
roboto_client (Optional[roboto.http.RobotoClient])
- property action_reference: roboto.domain.actions.action_record.ActionReference#
Reference to the action this trigger invokes.
- Return type:
- property compute_requirement_overrides: roboto.domain.actions.action_record.ComputeRequirements | None#
Optional compute requirement overrides.
- Return type:
Optional[roboto.domain.actions.action_record.ComputeRequirements]
- property container_parameter_overrides: roboto.domain.actions.action_record.ContainerParameters | None#
Optional container parameter overrides.
- Return type:
Optional[roboto.domain.actions.action_record.ContainerParameters]
- classmethod create(name, schedule, action_name, action_owner_id=None, compute_requirement_overrides=None, container_parameter_overrides=None, enabled=True, invocation_input=None, invocation_upload_destination=None, parameter_values=None, timeout=None, caller_org_id=None, roboto_client=None)#
Create a new scheduled trigger.
If the trigger is enabled on creation, action invocations will commence on the provided schedule. Note that the total number of active triggers in an organization is subject to a tier-specific limit. Exceeding that limit will result in the trigger being disabled.
- Parameters:
name (str) – Unique name for the scheduled trigger. Must not exceed 256 characters.
schedule (Union[str, TriggerSchedule]) – Recurring schedule for the trigger, e.g. hourly.
action_name (str) – Name of the action to invoke on schedule.
action_owner_id (Optional[str]) – Organization ID that owns the target action. If not provided, searches the caller’s organization.
compute_requirement_overrides (Optional[roboto.domain.actions.action_record.ComputeRequirements]) – Optional compute requirement overrides for action invocations.
container_parameter_overrides (Optional[roboto.domain.actions.action_record.ContainerParameters]) – Optional container parameter overrides for action invocations.
enabled (bool) – Whether the trigger should be active immediately after creation.
invocation_input (Optional[roboto.domain.actions.invocation_record.InvocationInput]) – Optional input specification to be used for all scheduled action invocations.
invocation_upload_destination (Optional[roboto.domain.actions.invocation_record.InvocationUploadDestination]) – Optional upload destination for invocation outputs. Currently supports datasets.
parameter_values (Optional[dict[str, Any]]) – Optional parameter values to pass to the action when invoked.
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.http.RobotoClient]) – Roboto client instance. If not provided, defaults to the caller’s Roboto configuration.
- Returns:
The newly created
ScheduledTrigger
instance.- Raises:
ValueError – If request parameters have invalid values, e.g. a negative timeout.
RobotoInvalidRequestException – If the request cannot be satisfied as provided.
RobotoUnauthorizedException – If the caller lacks permission to create triggers, invoke the specified action or upload to the specified upload destination.
RobotoConflictException – If a scheduled trigger with the provided name already exists in the target organization.
RobotoLimitExceededException – If the caller has exceeded their organization’s maximum action timeout limit (in minutes).
- Return type:
Examples
Create an hourly trigger to invoke an analytics action with no explicit inputs:
>>> from roboto.domain.actions import ScheduledTrigger, TriggerSchedule >>> scheduled_trigger = ScheduledTrigger.create( ... name="analytics_action_hourly_trigger", ... action_name="analytics_action", ... schedule=TriggerSchedule.hourly(), ... )
Create a daily trigger to invoke an action that processes CSV files created after a given date:
>>> from roboto.domain.actions import ScheduledTrigger, TriggerSchedule, InvocationInput >>> scheduled_trigger = ScheduledTrigger.create( ... name="csv_processor_daily_trigger", ... action_name="csv_processor", ... schedule=TriggerSchedule.daily(), ... invocation_input=InvocationInput.file_query("created > '2025-04-05' AND path LIKE '%.csv'") ... )
- property created: datetime.datetime#
Creation time for this scheduled trigger.
- Return type:
datetime.datetime
- property created_by: str#
User who created this scheduled trigger.
- Return type:
str
- delete()#
Delete this scheduled trigger.
- Return type:
None
- disable()#
Disable this scheduled trigger.
If the trigger is already disabled, the call has no effect.
Any currently running scheduled invocations will proceed to completion, but no new scheduled invocations will occur, unless and until the trigger is re-enabled.
- Return type:
None
- enable()#
Enable this scheduled trigger.
If the trigger is already enabled, the call has no effect.
The total number of active triggers within an organization is subject to a tier-specific limit. If this operation results in the limit being exceeded, this trigger will remain disabled.
- Returns:
True
if the trigger is now enabled,False
otherwise.- Return type:
bool
- property enabled: bool#
True if this scheduled trigger is enabled.
- Return type:
bool
- classmethod from_id(trigger_id, owner_org_id=None, roboto_client=None)#
Fetch a scheduled trigger by its unique ID.
- Parameters:
trigger_id (str) – Unique trigger ID.
owner_org_id (Optional[str]) – Organization ID which owns the trigger. Defaults to caller’s org.
roboto_client (Optional[roboto.http.RobotoClient]) – Roboto client instance. If not provided, defaults to the caller’s Roboto configuration.
- Returns:
The
ScheduledTrigger
with the provided unique ID.- Raises:
RobotoNotFoundException – If no scheduled trigger exists with the provided ID in the target organization.
RobotoUnauthorizedException – If the caller is not a member of the trigger’s target organization.
- Return type:
- classmethod from_name(name, owner_org_id=None, roboto_client=None)#
Fetch a scheduled trigger by its unique name within an organization.
- Parameters:
name (str) – Name of the scheduled trigger.
owner_org_id (Optional[str]) – Organization ID which owns the trigger. Defaults to caller’s org.
roboto_client (Optional[roboto.http.RobotoClient]) – Roboto client instance. If not provided, defaults to the caller’s Roboto configuration.
- Returns:
The
ScheduledTrigger
with the provided unique name.- Raises:
RobotoNotFoundException – If no scheduled trigger exists with the provided name in the target organization.
RobotoUnauthorizedException – If the caller is not a member of the trigger’s target organization.
- Return type:
- get_action()#
Get the target
Action
for this scheduled trigger.- Returns:
The action this trigger invokes on a recurring schedule.
- Return type:
- get_evaluations()#
Get the evaluation history for this scheduled trigger.
Under normal circumstances, this trigger’s target action will simply be invoked on the configured schedule, for as long as the trigger is enabled. However, it’s possible that an error occurs when attempting to invoke the action. In either case, a trigger evaluation record is created to capture the details of what happened.
- Returns:
A generator that yields
TriggerEvaluationRecord
instances, ordered by descending evaluation start time.- Return type:
collections.abc.Generator[roboto.domain.actions.trigger_record.TriggerEvaluationRecord, None, None]
- get_invocations()#
Get the scheduled invocations initiated by this trigger, if any.
- Returns:
A generator that yields
Invocation
instances for any scheduled invocations kicked off by this trigger. The invocations are ordered from most to least recently created.- Return type:
collections.abc.Generator[roboto.domain.actions.invocation.Invocation, None, None]
- property invocation_input: roboto.domain.actions.invocation_record.InvocationInput | None#
Optional input specification for action invocations.
- Return type:
Optional[roboto.domain.actions.invocation_record.InvocationInput]
- property invocation_upload_destination: roboto.domain.actions.invocation_record.InvocationUploadDestination | None#
Optional upload destination for action invocation outputs.
- Return type:
Optional[roboto.domain.actions.invocation_record.InvocationUploadDestination]
- property modified: datetime.datetime#
Last modification time for this scheduled trigger.
- Return type:
datetime.datetime
- property modified_by: str#
User who last modified this scheduled trigger.
- Return type:
str
- property name: str#
This trigger’s name, unique among scheduled triggers in the org.
- Return type:
str
- property org_id: str#
Organization ID which owns this scheduled trigger.
- Return type:
str
- property parameter_values: dict[str, Any] | None#
Optional action parameter values.
- Return type:
Optional[dict[str, Any]]
- property record: roboto.domain.actions.scheduled_trigger_record.ScheduledTriggerRecord#
Wire-transmissible representation of this scheduled trigger.
- property schedule: str#
Invocation schedule for the target action.
- Return type:
str
- property timeout: int | None#
Optional invocation timeout, in minutes.
- Return type:
Optional[int]
- property trigger_id: str#
Unique ID of the scheduled trigger.
- Return type:
str
- update(action_name=NotSet, action_owner_id=NotSet, compute_requirement_overrides=NotSet, container_parameter_overrides=NotSet, enabled=NotSet, invocation_input=NotSet, invocation_upload_destination=NotSet, parameter_values=NotSet, schedule=NotSet, timeout=NotSet)#
Update this scheduled trigger.
Changing the action associated with this trigger, or the default upload destination, are subject to authorization checks. Enabling the trigger or changing the target action’s timeout are subject to tier-specific organization limit checks.
Per Roboto convention, the sentinel value
NotSet
is the default for all arguments to this call, indicating that the corresponding trigger attribute should not be updated. The valueNone
, on the other hand, indicates that the relevant trigger attribute should be set toNone
(i.e. cleared).- Parameters:
action_name (Union[str, roboto.sentinels.NotSetType]) – Name of the target action to associate with this trigger.
action_owner_id (Union[str, roboto.sentinels.NotSetType]) – Organization ID that owns the target action.
compute_requirement_overrides (Union[Optional[roboto.domain.actions.action_record.ComputeRequirements], roboto.sentinels.NotSetType]) – Optional compute requirement overrides for action invocations.
container_parameter_overrides (Union[Optional[roboto.domain.actions.action_record.ContainerParameters], roboto.sentinels.NotSetType]) – Optional container parameter overrides for action invocations.
enabled (Union[bool, roboto.sentinels.NotSetType]) – Whether the trigger should be active immediately after creation.
invocation_input (Union[Optional[roboto.domain.actions.invocation_record.InvocationInput], roboto.sentinels.NotSetType]) – Optional input specification to be used for all scheduled action invocations.
invocation_upload_destination (Union[Optional[roboto.domain.actions.invocation_record.InvocationUploadDestination], roboto.sentinels.NotSetType]) – Optional upload destination for invocation outputs.
parameter_values (Union[Optional[dict[str, Any]], roboto.sentinels.NotSetType]) – Optional parameter values to pass to the action when invoked.
schedule (Union[str, TriggerSchedule, roboto.sentinels.NotSetType]) – Recurring schedule for the trigger, e.g. hourly.
timeout (Union[Optional[int], roboto.sentinels.NotSetType]) – Optional timeout override for action invocations, in minutes.
- Returns:
This trigger with any updates applied.
- Raises:
ValueError – If request parameters have invalid values, e.g. a negative timeout.
RobotoInvalidRequestException – If the request cannot be satisfied as provided.
RobotoUnauthorizedException – If the caller lacks permission to invoke the specified action or upload to the specified upload destination.
RobotoLimitExceededException – If the caller has exceeded their organization’s maximum action timeout limit (in minutes).
- Return type:
- class roboto.domain.actions.scheduled_trigger.TriggerSchedule(cron_string)#
Utility for defining trigger schedules.
- Parameters:
cron_string (str)
- classmethod cron(cron_string)#
Create a trigger schedule based on a Cron expression.
- Parameters:
cron_string (str) – A Cron expression like */30 * * * *.
- Returns:
A
TriggerSchedule
instance.- Raises:
ValueError – If the provided string is not a valid Cron expression.
- Return type:
- property cron_string: str#
Cron string representing the schedule.
- Return type:
str
- classmethod daily()#
Every day at midnight UTC.
- Return type:
- classmethod hourly()#
Every hour on the hour.
- Return type:
- classmethod monthly()#
Every 1st of the month at midnight UTC.
- Return type:
- classmethod weekly()#
Every Sunday at midnight UTC.
- Return type: