ogstools.core.execution module#

class ogstools.core.execution.Execution[source]#

Bases: StorageBase

Configuration for OGS simulation execution parameters.

This class encapsulates all settings related to how an OGS simulation is executed, including parallelization, containerization, and logging options.

Initialize an Execution configuration.

Parameters:
  • interactive (bool) – If True, use interactive mode for stepwise control.

  • args (Any | None) – Additional command-line arguments for OGS.

  • container_path (Path | str | None) – Path to a container (e.g., Docker, Apptainer).

  • wrapper (Any | None) – Custom wrapper command for execution.

  • mpi_ranks (int | None) – Number of MPI ranks for parallel execution.

  • ogs_bin_path (Path | str) – Path to the OGS binary. Defaults to “ogs”.

  • omp_num_threads (int | None) – Number of OpenMP threads per MPI rank.

  • ogs_asm_threads (int | None) – Number of assembly threads for OGS.

  • write_logs (bool) – If True, write log output to file.

  • log_level (str) – Logging level (e.g., “info”, “debug”, “warn”).

  • id (str | None) – Optional unique identifier for this execution config.

__init__(interactive=False, args=None, container_path=None, wrapper=None, mpi_ranks=None, ogs_bin_path=Path('ogs'), omp_num_threads=None, ogs_asm_threads=None, write_logs=True, log_level='info', id=None)[source]#

Initialize an Execution configuration.

Parameters:
  • interactive (bool) – If True, use interactive mode for stepwise control.

  • args (Any | None) – Additional command-line arguments for OGS.

  • container_path (Path | str | None) – Path to a container (e.g., Docker, Apptainer).

  • wrapper (Any | None) – Custom wrapper command for execution.

  • mpi_ranks (int | None) – Number of MPI ranks for parallel execution.

  • ogs_bin_path (Path | str) – Path to the OGS binary. Defaults to “ogs”.

  • omp_num_threads (int | None) – Number of OpenMP threads per MPI rank.

  • ogs_asm_threads (int | None) – Number of assembly threads for OGS.

  • write_logs (bool) – If True, write log output to file.

  • log_level (str) – Logging level (e.g., “info”, “debug”, “warn”).

  • id (str | None) – Optional unique identifier for this execution config.

classmethod from_file(filepath)[source]#

Restore an Execution object from an execution.yaml file.

Parameters:

filepath (Path | str) – Path to execution.yaml file.

Return type:

Self

Returns:

Restored Execution instance.

Raises:

FileNotFoundError – If the specified file does not exist.

classmethod from_id(execution_id)[source]#

Load Execution from the user storage path using its ID. StorageBase.Userpath must be set.

Parameters:

execution_id (str) – The unique ID of the Execution to load.

Return type:

Execution

Returns:

An Execution instance restored from disk.

save(target=None, overwrite=None, dry_run=False, archive=False, id=None)[source]#
Return type:

list[Path]