Skip to content

Manage runs

Use these methods to retrieve, import, update, or delete runs.

Read

Retrieve runs from the backend or import them from a YAML descriptor.

get_run

Get an unversioned run entity from the backend.

Parameters:

Name Type Description Default
identifier str

Entity ID or entity key in the format store://<project>/<entity_type>/<kind>/<uuid>.

required
project str

Project name. Required when identifier is an entity ID.

None

Returns:

Type Description
Run

Retrieved run entity.

Examples:

Get a run by ID and project:

import digitalhub as dh

run = dh.get_run("my-run-id", project="my-project")

Get a run by key:

run = dh.get_run("store://my-project/run/python+run/my-run-id")
list_runs

List run entities in a project.

Parameters:

Name Type Description Default
project str

Project name.

required
q str

Query string used to filter entities.

None
name str

Entity name used to filter results.

None
kind str

Entity kind used to filter results.

None
user str

User who created the entity.

None
state str

Entity state used to filter results.

None
created str

Creation date filter.

None
updated str

Update date filter.

None
function str

Function reference used to filter results.

None
workflow str

Workflow reference used to filter results.

None
task str

Task reference used to filter results.

None
action str

Action name used to filter results.

None

Returns:

Type Description
list[Run]

Run entities matching the filters.

Examples:

List runs in a project:

import digitalhub as dh

runs = dh.list_runs(project="my-project")
import_run

Import a run entity from a YAML file or entity key.

Parameters:

Name Type Description Default
file str

Path to a YAML file containing the entity descriptor. Provide either file or key.

None
key str

Entity key in the format store://<project>/<entity_type>/<kind>/<uuid>. Provide either file or key.

None
reset_id bool

Whether to generate a new entity identifier instead of preserving the identifier from the imported entity.

False
context str

Project name used for context resolution. If omitted, the project from the entity descriptor is used.

None

Returns:

Type Description
Run

Imported run entity.

Examples:

Import a run from a YAML file:

import digitalhub as dh

run = dh.import_run("my-run.yaml")

Update

Update a run after changing its mutable metadata.

update_run

Update a run entity in the backend.

Parameters:

Name Type Description Default
entity Run

Entity to update. The entity specification is immutable.

required

Returns:

Type Description
Run

Updated run entity.

Examples:

Update a run description:

import digitalhub as dh

run = dh.get_run("my-run-id", project="my-project")
run.set_description("Updated run")
run = dh.update_run(run)

Delete

Delete a run from the backend.

delete_run

Delete an unversioned run entity from the backend.

Parameters:

Name Type Description Default
identifier str

Entity ID or entity key in the format store://<project>/<entity_type>/<kind>/<uuid>.

required
project str

Project name. Required when identifier is an entity ID.

None
entity_id str

Identifier of the entity to delete. If omitted, identifier is used.

None

Returns:

Type Description
dict

Response data from the backend.

Examples:

Delete a run by ID and project:

import digitalhub as dh

dh.delete_run("my-run-id", project="my-project")

Delete a run by key:

dh.delete_run("store://my-project/run/python+run/my-run-id")