roboto.domain.actions.invocation
Module Contents
Invocation
An instance of an execution of an action, initiated manually by a user or automatically by a trigger.
An Invocation represents a single execution of an Action with specific inputs, parameters, and configuration. It tracks the execution lifecycle from creation through completion, including status updates, logs, and results.
Invocations are created by calling Action.invoke() or through the UI. They cannot be created directly through the constructor. Each invocation has a unique ID and maintains a complete audit trail of its execution.
Key features:
- Status tracking (Queued, Running, Completed, Failed, etc.)
- Input data specification and parameter values
- Compute requirement and container parameter overrides
- Log collection and output file management
- Progress monitoring and result retrieval
Parameters
roboto_client Optional[roboto.Properties
Invocation.action
Provenance information about the action that was invoked.
Invocation.cancel()
Cancel this invocation if it is not already in a terminal status.
Attempts to cancel the invocation. If the invocation has already completed, failed, or reached another terminal status, this method has no effect.
Raises
If the invocation is not found.
If the caller lacks permission to cancel the invocation.
Return type
Usage
Cancel a running invocation:
invocation = Invocation.from_id("iv_12345")
if not invocation.reached_terminal_status:
invocation.cancel()Properties
Invocation.compute_requirements
The compute requirements (CPU, memory) used for this invocation.
Invocation.container_parameters
The container parameters used for this invocation.
Invocation.created
The timestamp when this invocation was created.
Invocation.current_status
The current status of this invocation (e.g., Queued, Running, Completed).
Invocation.data_source
The data source that provided input data for this invocation.
Invocation.executable
Provenance information about the executable (container) that was run.
Invocation.from_id()
Load an existing invocation by its ID.
Retrieves an invocation from the Roboto platform using its unique identifier.
Parameters
invocation_id strThe unique ID of the invocation to retrieve.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Returns
The Invocation instance.
Raises
If the invocation is not found.
If the caller lacks permission to access the invocation.
Usage
Load an invocation and check its status:
invocation = Invocation.from_id("iv_12345")
print(f"Status: {invocation.current_status}")
print(f"Created: {invocation.created}")Invocation.get_logs()
Retrieve runtime STDOUT/STDERR logs generated during this invocation’s execution.
Fetches log records from the invocation’s container execution, with support for pagination to handle large log volumes.
Parameters
page_token Optional[str]Optional token for pagination. If provided, starts retrieving logs from that point.
Yields
LogRecord instances containing log messages and metadata.
Raises
If the invocation is not found.
If the caller lacks permission to access logs.
Return type
Properties
Invocation.input_data
The input data specification for this invocation, if any.
Invocation.is_queued_for_scheduling()
An invocation is queued for scheduling if:
1. its most recent status is “Queued” 3. and is not “Deadly”
Return type
Invocation.query()
Query invocations with optional filtering and pagination.
Searches for invocations based on the provided query specification. Can filter by status, action name, creation time, and other attributes.
Parameters
spec Optional[roboto.Query specification with filters, sorting, and pagination. If not provided, returns all accessible invocations.
owner_org_id Optional[str]Organization ID to search within. If not provided, searches in the caller’s organization.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Yields
Invocation instances matching the query criteria.
Raises
ValueErrorIf the query specification contains unknown fields.
If the query filters or sorts on a field the invocations API does not accept.
If the caller lacks permission to query invocations.
Return type
Usage
Query all invocations:
for invocation in Invocation.query():
print(f"Invocation: {invocation.id}")Query invocations whose data source is a given dataset:
from roboto.query import Comparator, Condition, QuerySpecification
spec = QuerySpecification(
condition=Condition(
field="data_source_id",
comparator=Comparator.Equals,
value="ds_abc123",
)
)
for invocation in Invocation.query(spec):
print(invocation.id)Query completed invocations:
from roboto.domain.actions import InvocationStatus
spec = QuerySpecification(
condition=Condition(
field="last_status",
comparator=Comparator.Equals,
value=InvocationStatus.Completed.value,
)
)
completed = list(Invocation.query(spec))Query the ten most recent invocations. Neither limit nor max_results caps an invocation query, so take the first ten from the generator:
import itertools
from roboto.query import SortDirection
spec = QuerySpecification(sort_by="created", sort_direction=SortDirection.Descending)
recent = list(itertools.islice(Invocation.query(spec), 10))Properties
Invocation.reached_terminal_status
True if this invocation has reached a terminal status (Completed, Failed, etc.).
Invocation.record
The underlying invocation record containing all invocation data.
Invocation.refresh()
Return type
Invocation.set_container_image_digest()
This is an admin-only operation to memorialize the digest of the container image that was pulled in the course of invoking the action.
Parameters
digest strReturn type
Invocation.set_logs_location()
This is an admin-only operation to memorialize the base location where invocation logs are saved.
Use the “get_logs” or “stream_logs” methods to access invocation logs.
Parameters
Return type
Properties
Invocation.source
Provenance information about the source that initiated this invocation.
Invocation.status_log
The complete history of status changes for this invocation.
Invocation.stream_logs()
Parameters
last_read Optional[str]Return type
Properties
Invocation.to_dict()
Return type
Invocation.update_status()
Parameters
detail Optional[str]Return type
Properties
Invocation.upload_destination
The destination where output files from this invocation will be uploaded.
Invocation.wait_for_terminal_status()
Wait for the invocation to reach a terminal status.
Throws a TimeoutError if the timeout is reached.
Parameters
timeout floatThe maximum amount of time, in seconds, to wait for the invocation to reach a terminal status.
poll_interval roboto.The amount of time, in seconds, to wait between polling iterations.
Return type