Skip to content

lifecycle

lifecycle

Workspace lifecycle management for Marianne jobs.

Handles archival of workspace files when --fresh is used on self-chaining jobs. This prevents stale validation artifacts from causing false-positive validations on subsequent iterations.

Classes

WorkspaceArchiver

WorkspaceArchiver(workspace, config)

Archives workspace files to numbered subdirectories.

Used when --fresh flag clears state, to also move non-essential workspace files out of the way so validations (file_exists, command_succeeds) don't pass on stale artifacts from previous iterations.

Source code in src/marianne/workspace/lifecycle.py
def __init__(
    self, workspace: Path, config: WorkspaceLifecycleConfig
) -> None:
    self.workspace = workspace
    self.config = config
Functions
archive
archive()

Archive non-preserved workspace files.

Returns:

Type Description
Path | None

Path to the created archive directory, or None if nothing was archived.

Source code in src/marianne/workspace/lifecycle.py
def archive(self) -> Path | None:
    """Archive non-preserved workspace files.

    Returns:
        Path to the created archive directory, or None if nothing was archived.
    """
    try:
        return self._do_archive()
    except (OSError, ValueError) as e:
        _logger.warning(
            "workspace_archive_failed",
            workspace=str(self.workspace),
            error=str(e),
            exc_info=True,
        )
        return None

Functions