Skip to content

resume

resume

Resume command for Marianne CLI.

This module implements the mzt resume command which continues execution of paused or failed jobs.

★ Insight ───────────────────────────────────── 1. Config reconstruction hierarchy: The resume command has a clear priority for config sources: (1) provided --config file, (2) auto-reload from stored config_path if file exists, (3) cached config_snapshot fallback. This fallback chain ensures maximum flexibility while maintaining state consistency.

  1. Resumable state validation: Only PAUSED, FAILED, and RUNNING jobs can be resumed. COMPLETED jobs require --force flag to override. This prevents accidental re-execution while still allowing intentional retries.

  2. Progress callback injection: The same progress_callback pattern from run.py is used here, enabling seamless visual continuity between fresh runs and resumes. ─────────────────────────────────────────────────

Classes

Functions

resume

resume(job_id=Argument(..., help='Score ID to resume'), config_file=Option(None, '--config', '-c', help='Path to config file (optional if config_snapshot exists in state)', exists=True, readable=True), force=Option(False, '--force', '-f', help='Force resume even if score appears completed'), escalation=Option(False, '--escalation', '-e', help='Enable human-in-the-loop escalation for low-confidence sheets'), no_reload=Option(False, '--no-reload', help='Use cached config snapshot instead of auto-reloading from YAML file. By default, Marianne reloads from the original config path if the file exists.'), self_healing=Option(False, '--self-healing', '-H', help='Enable automatic diagnosis and remediation when retries are exhausted'), yes=Option(False, '--yes', '-y', help='Auto-confirm suggested fixes when using --self-healing'))

Resume a paused or failed score.

Loads the score state and continues execution from where it left off. By default, Marianne auto-reloads config from the original YAML file if it still exists on disk. Use --no-reload to use the cached snapshot.

Examples:

mzt resume my-job mzt resume my-job --config job.yaml mzt resume my-job --no-reload # Use cached config snapshot

Source code in src/marianne/cli/commands/resume.py
def resume(
    job_id: str = typer.Argument(..., help="Score ID to resume"),
    config_file: Path | None = typer.Option(
        None,
        "--config",
        "-c",
        help="Path to config file (optional if config_snapshot exists in state)",
        exists=True,
        readable=True,
    ),
    force: bool = typer.Option(
        False,
        "--force",
        "-f",
        help="Force resume even if score appears completed",
    ),
    escalation: bool = typer.Option(
        False,
        "--escalation",
        "-e",
        help="Enable human-in-the-loop escalation for low-confidence sheets",
    ),
    no_reload: bool = typer.Option(
        False,
        "--no-reload",
        help="Use cached config snapshot instead of auto-reloading from YAML file. "
        "By default, Marianne reloads from the original config path if the file exists.",
    ),
    self_healing: bool = typer.Option(
        False,
        "--self-healing",
        "-H",
        help="Enable automatic diagnosis and remediation when retries are exhausted",
    ),
    yes: bool = typer.Option(
        False,
        "--yes",
        "-y",
        help="Auto-confirm suggested fixes when using --self-healing",
    ),
) -> None:
    """Resume a paused or failed score.

    Loads the score state and continues execution from where it left off.
    By default, Marianne auto-reloads config from the original YAML file
    if it still exists on disk. Use --no-reload to use the cached snapshot.

    Examples:
        mzt resume my-job
        mzt resume my-job --config job.yaml
        mzt resume my-job --no-reload  # Use cached config snapshot
    """
    from ._shared import validate_job_id

    job_id = validate_job_id(job_id)
    asyncio.run(
        _resume_job(
            job_id, config_file, force, escalation,
            no_reload, self_healing, yes
        )
    )