Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.actions.invocation

Module Contents

Invocation

class roboto.domain.actions.invocation.Invocation(record, roboto_client=None)#View Source

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

Properties

Invocation.action

Provenance information about the action that was invoked.

Invocation.cancel()

cancel()#View Source

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

None

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

created datetime.datetime #

The timestamp when this invocation was created.

Return type: datetime.datetime

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()

classmethod from_id(invocation_id, roboto_client=None)#View Source

Load an existing invocation by its ID.

Retrieves an invocation from the Roboto platform using its unique identifier.

Parameters

invocation_id str

The unique ID of the invocation to retrieve.

roboto_client Optional[roboto.http.RobotoClient]

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()

get_logs(page_token=None)#View Source

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

collections.abc.Generator[roboto.domain.actions.invocation_record.LogRecord, None, None]

Properties

Invocation.id

id str #

The unique identifier for this invocation.

Return type: str

Invocation.input_data

The input data specification for this invocation, if any.

Invocation.is_queued_for_scheduling()

is_queued_for_scheduling()#View Source

An invocation is queued for scheduling if:

1. its most recent status is “Queued” 3. and is not “Deadly”

Return type

bool

Properties

Invocation.org_id

org_id str #

The organization ID that owns this invocation.

Return type: str

Invocation.parameter_values

parameter_values dict[str, Any] #

The parameter values that were provided when this invocation was created.

Return type: dict[str, Any]

Invocation.query()

classmethod query(spec=None, owner_org_id=None, roboto_client=None)#View Source

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

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.http.RobotoClient]

Roboto client instance. Uses default if not provided.

Yields

Invocation instances matching the query criteria.

Raises

ValueError

If 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

collections.abc.Generator[Invocation, None, None]

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

reached_terminal_status bool #

True if this invocation has reached a terminal status (Completed, Failed, etc.).

Return type: bool

Invocation.record

The underlying invocation record containing all invocation data.

Invocation.refresh()

refresh()#View Source

Return type

Invocation.set_container_image_digest()

set_container_image_digest(digest)#View Source

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 str

Return type

Invocation.set_logs_location()

set_logs_location(logs)#View Source

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.

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()

stream_logs(last_read=None)#View Source

Parameters

last_read Optional[str]

Return type

collections.abc.Generator[roboto.domain.actions.invocation_record.LogRecord, None, Optional[str]]

Properties

Invocation.timeout

timeout int #

The timeout in minutes for this invocation.

Return type: int

Invocation.to_dict()

to_dict()#View Source

Return type

dict[str, Any]

Invocation.update_status()

update_status(next_status, detail=None)#View Source

Parameters

Return type

Properties

Invocation.upload_destination

The destination where output files from this invocation will be uploaded.

Invocation.wait_for_terminal_status()

wait_for_terminal_status(timeout=60 * 5, poll_interval=5)#View Source

Wait for the invocation to reach a terminal status.

Throws a TimeoutError if the timeout is reached.

Parameters

timeout float

The maximum amount of time, in seconds, to wait for the invocation to reach a terminal status.

The amount of time, in seconds, to wait between polling iterations.

Return type

None

Was this page helpful?