Runs

class ixmp4.core.run.Run(**kwargs: Unpack[RunKwargs])

Bases: BaseModelFacade

NoDefaultVersion

alias of NoDefaultRunVersion

NotFound

alias of RunNotFound

NotUnique

alias of RunNotUnique

checkpoints: RunCheckpoints
clone(model: str | None = None, scenario: str | None = None, keep_solution: bool = True) Run
delete() None

Delete this run. Tries to acquire a lock in the background.

Raises

ixmp4.core.exceptions.RunIsLocked:

If the run is already locked by this or another object.

property id: int

Unique id.

property is_default: bool
maximum_lock_timeout: float = 5
property meta: RunMetaFacade

Meta indicator data (dict-like).

minimum_lock_timeout: float = 0.1
property model: Model

Associated model.

owns_lock: bool = False
require_lock() None
property scenario: Scenario

Associated scenario.

set_as_default() None

Sets this run as the default version for its model + scenario combination.

transact(message: str, timeout: float | None = None) Generator[None, None, None]

Context manager to lock the run before yielding control back to the caller. The run is unlocked and a checkpoint with the provided message is created after the context manager exits. If an exception occurs, the run is reverted to the last checkpoint or if no checkpoint exists, to the transaction the run was locked at.

If the run is already locked, the context manager will throw Run.IsLocked or if timeout is provided retry until the timeout has passed (and then throw the original Run.IsLocked exception).

Parameters

messsagestr

The message for the checkpoint created after conclusion of the context manager.

timeoutint, optional

Timeout in seconds.

Raises

ixmp4.core.exceptions.RunIsLocked

If the run is already locked and no timeout is provided or the provided timeout is exceeded.

unset_as_default() None

Unsets this run as the default version.

class ixmp4.core.run.RunKwargs

Bases: TypedDict

class ixmp4.core.run.RunMetaFacade(run: Run, **kwargs: Backend)

Bases: BaseFacade, UserDict[str, bool | float | int | str | None]

refetch_data() None
run: Run
class ixmp4.core.run.RunRepository(_backend: Backend | None = None)

Bases: BaseFacade

create(model: str, scenario: str) Run
delete(x: Run | int) None
get(model: str, scenario: str, version: int | None = None) Run
list(**kwargs: Unpack[EnumerateKwargs]) list[Run]
tabulate(audit_info: bool = False, **kwargs: Unpack[EnumerateKwargs]) DataFrame
ixmp4.core.run.numpy_to_pytype(value: bool | float | int | str | generic | None) bool | float | int | str | None

Cast numpy-types to basic Python types