roboto.domain.actions.trigger_record#

Module Contents#

class roboto.domain.actions.trigger_record.TriggerEvaluationCause#

Bases: enum.Enum

The cause of a TriggerEvaluationRecord is the reason why the trigger was selected for evaluation.

Represents the specific event that caused a trigger to be evaluated for potential execution. Different causes may result in different trigger behavior or input data selection.

DatasetMetadataUpdate = 'dataset_metadata_update'#

Trigger evaluation caused by changes to dataset metadata.

FileIngest = 'file_ingest'#

Trigger evaluation caused by files being ingested into a dataset.

FileUpload = 'file_upload'#

Trigger evaluation caused by new files being uploaded to a dataset.

class roboto.domain.actions.trigger_record.TriggerEvaluationDataConstraint(/, **data)#

Bases: pydantic.BaseModel

An optional filtering constraint applied to the data considered by a trigger evaluation.

Each trigger evaluation considers data of a particular data source ID and data source type. Typically (and to start, exclusively), this is a dataset ID (and type Dataset).

In the naive case before the introduction of this class, trigger evaluation for a dataset with 20k files would have to scan each file. This constraint allows us to filter the data to a subset during evaluation, e.g. only evaluate files from dataset ds_12345 with upload ID tx_123abc

Parameters:

data (Any)

transaction_id: str | None = None#

If set, only consider files from this upload.

class roboto.domain.actions.trigger_record.TriggerEvaluationOutcome#

Bases: enum.Enum

The outcome of a TriggerEvaluationRecord is the result of the evaluation. A trigger can either invoke its associated action (one or many times) or be skipped. If skipped, a skip reason is provided.

InvokedAction = 'invoked_action'#
Skipped = 'skipped'#
class roboto.domain.actions.trigger_record.TriggerEvaluationOutcomeReason#

Bases: enum.Enum

Context for why a trigger evaluation has its TriggerEvaluationOutcome

AlreadyRun = 'already_run'#

This trigger has already run its associated action for this dataset and/or file.

ConditionNotMet = 'condition_not_met'#

The trigger’s condition is not met.

NoMatchingFiles = 'no_matching_files'#

In the case of a dataset trigger, there is no subset of files that, combined, match ALL of the trigger’s required inputs.

In the case of a file trigger, there are no files that match ANY of the trigger’s required inputs.

TriggerDisabled = 'trigger_disabled'#

The trigger is disabled.

class roboto.domain.actions.trigger_record.TriggerEvaluationRecord(/, **data)#

Bases: pydantic.BaseModel

Record of a point-in-time evaluation of whether to invoke an action associated with a trigger for a data source.

Parameters:

data (Any)

cause: TriggerEvaluationCause | None = None#
data_constraint: TriggerEvaluationDataConstraint | None = None#
data_source: roboto.domain.actions.invocation_record.InvocationDataSource#
evaluation_end: datetime.datetime | None = None#
evaluation_start: datetime.datetime#
outcome: TriggerEvaluationOutcome | None = None#
outcome_reason: TriggerEvaluationOutcomeReason | None = None#
status: TriggerEvaluationStatus#
status_detail: str | None = None#
trigger_evaluation_id: int#
trigger_id: str#
class roboto.domain.actions.trigger_record.TriggerEvaluationStatus#

Bases: enum.Enum

When a trigger is selected for evaluation, a trigger evaluation record is created with a status of Pending. The evaluation can either run to completion (regardless of its outcome), in which case the status is Evaluated, or hit an unexpected exception, in which case the status is Failed.

Evaluated = 'evaluated'#
Failed = 'failed'#
Pending = 'pending'#
class roboto.domain.actions.trigger_record.TriggerForEachPrimitive#

Bases: str, enum.Enum

Defines the granularity at which a trigger executes.

Determines whether the trigger creates one invocation per dataset or one invocation per file within datasets that match the trigger conditions.

Dataset = 'dataset'#

Execute one action invocation per dataset that matches the trigger conditions.

DatasetFile = 'dataset_file'#

Execute one action invocation per file in datasets that match the trigger conditions.

class roboto.domain.actions.trigger_record.TriggerRecord(/, **data)#

Bases: pydantic.BaseModel

A wire-transmissible representation of a trigger.

Contains all the configuration and metadata for a trigger, including the target action, input requirements, conditions, and execution settings.

This is the underlying data structure used by the Trigger domain class to store and transmit trigger information.

Parameters:

data (Any)

action: roboto.domain.actions.action_record.ActionReference#

Reference to the action that should be invoked.

additional_inputs: list[str] | None = None#

Optional additional file patterns to include.

causes: list[TriggerEvaluationCause] | None = None#

List of events that can cause this trigger to be evaluated.

compute_requirement_overrides: roboto.domain.actions.action_record.ComputeRequirements | None = None#

Optional compute requirement overrides.

condition: roboto.query.ConditionType | None = None#

Optional condition that must be met for trigger to fire.

container_parameter_overrides: roboto.domain.actions.action_record.ContainerParameters | None = None#

Optional container parameter overrides.

created: datetime.datetime#

Timestamp when the trigger was created.

created_by: str#

User ID who created the trigger.

enabled: bool = True#

Whether the trigger is currently active.

for_each: TriggerForEachPrimitive#

Granularity of trigger execution (Dataset or DatasetFile).

modified: datetime.datetime#

Timestamp when the trigger was last modified.

modified_by: str#

User ID who last modified the trigger.

name: str#

Human-readable name for the trigger.

org_id: str#

Organization ID that owns the trigger.

parameter_values: dict[str, Any] = None#

Parameter values to pass to the action.

required_inputs: list[str]#

File patterns that must be present for trigger to fire.

service_user_id: str#

Service user ID for authentication.

timeout: int | None = None#

Optional timeout override for action execution.

trigger_id: str#

Unique identifier for the trigger.

validate_additional_inputs(value)#
Parameters:

value (Optional[list[str]])

Return type:

Optional[list[str]]

validate_required_inputs(value)#
Parameters:

value (list[str])

Return type:

list[str]