Skip to content

Reference

platform.tools_api

API to interact with the tools API. To list available methods in this module, use:

from deeporigin.platform import tools_api
tools_api.__all__

src.platform.tools_api

bridge module to interact with the platform tools api

Attributes

NON_FAILED_STATES module-attribute

NON_FAILED_STATES = [
    "Succeeded",
    "Running",
    "Queued",
    "Created",
]

NON_TERMINAL_STATES module-attribute

NON_TERMINAL_STATES = {'Created', 'Queued', 'Running'}

PROVIDER module-attribute

PROVIDER = Literal['ufa', 's3']

TERMINAL_STATES module-attribute

TERMINAL_STATES = {
    "Succeeded",
    "Failed",
    "Cancelled",
    "Quoted",
    "InsufficientFunds",
    "FailedQuotation",
}

Functions

cancel_run

cancel_run(
    execution_id: str,
    *,
    client=None,
    org_key: Optional[str] = None
) -> None

cancel a run

Parameters:

Name Type Description Default
execution_id str

execution ID

required

cancel_runs

cancel_runs(
    job_ids: list[str] | Series | DataFrame,
    *,
    client=None,
    org_key: Optional[str] = None
) -> None

Cancel multiple jobs in parallel.

Parameters:

Name Type Description Default
job_ids list[str] | Series | DataFrame

List of job IDs to cancel.

required

get_default_cluster_id cached

get_default_cluster_id(
    *, client=None, org_key: Optional[str] = None
) -> str

get the default cluster id for a client

We default to using the first cluster that does not have "dev" in the hostname.

get_statuses_and_progress

get_statuses_and_progress(
    job_ids: list[str],
    *,
    client=None,
    org_key: Optional[str] = None
) -> list

get statuses and progress reports for multiple jobs in parallel

Parameters:

Name Type Description Default
job_ids list[str]

list of job IDs

required

query_run_status

query_run_status(
    execution_id: str,
    *,
    client=None,
    org_key: Optional[str] = None
) -> str

Determine the status of a run, identified by execution_id ID

Parameters:

Name Type Description Default
execution_id str

execution_id ID

required

Returns:

Type Description
str

One of "Created", "Queued", "Running", "Succeeded", or "Failed"

query_run_statuses

query_run_statuses(
    job_ids: list[str],
    *,
    client=None,
    org_key: Optional[str] = None
) -> dict

get statuses for multiple jobs in parallel

Parameters:

Name Type Description Default
job_ids list[str]

list of job IDs

required

run_tool

run_tool(
    *,
    data: dict,
    tool_key: str,
    client=None,
    org_key: Optional[str] = None
)

run any tool using provided data transfer object (DTO)

Parameters:

Name Type Description Default
data dict

data transfer object. This is typically generated by the make_payload function.

required
tool_key str

key of the tool to run

required
client Client

client to use to run the tool

None
org_key str

key of the organization to use to run the tool. If not provided, the org_key will be inferred from the client or the environment variable DEEPORIGIN_ORG_KEY, or the value in the config file.

None