run
run
¶
Run command for Marianne CLI.
This module implements the mzt run command which routes scores
through a running conductor (mzt start). Direct execution is not
supported — a running conductor is required (like docker requires dockerd).
The only exception is --dry-run, which validates and displays the
execution plan without executing anything (no conductor needed).
Classes¶
SubmitStatus
¶
Bases: str, Enum
How a submission ended (#561).
What the conductor did with it, or why it never got there. submit_score
returns one of these; the commands render.
SubmitResult
dataclass
¶
SubmitResult(status, job_id=None, message='', error='', response=None, pid=None, cause=None, fresh=False)
A submission outcome as a value: no printing, no typer.Exit.
Attributes:
| Name | Type | Description |
|---|---|---|
status |
SubmitStatus
|
Which :class: |
job_id |
str | None
|
The conductor-assigned job id, when known. |
message |
str
|
The conductor's message, or the refusal reason. |
error |
str
|
The |
response |
dict[str, Any] | None
|
The conductor's raw reply dict, when it sent one: the
|
pid |
int | None
|
On |
cause |
Exception | None
|
The exception behind a |
fresh |
bool
|
Whether the submission asked for a fresh run; selects the "already running" hint, so a renderer needs no extra argument. |
Functions:¶
run
¶
run(config_file=Argument(..., help='Path to YAML score configuration file', exists=True, readable=True), dry_run=Option(False, '--dry-run', '-n', help='Show what would be executed without running'), start_sheet=Option(None, '--start-sheet', '-s', help='Override starting sheet number'), workspace=Option(None, '--workspace', '-w', hidden=True, help="Expert override of the workspace directory. By default the conductor auto-manages workspaces under ~/workspaces/<score-name> (or the score's explicit workspace:), so this is rarely needed. Takes precedence over both. Creates the directory if absent."), json_output=Option(False, '--json', '-j', help='Output result as JSON for machine parsing'), escalation=Option(False, '--escalation', '-e', help='Pause sheets in FERMATA on retry exhaustion for a composer decision (resolve via mzt status instructions). Works without --self-healing.'), 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'), fresh=Option(False, '--fresh', help="Start over from scratch: re-register the score (all sheets re-run) and, when the score sets workspace_lifecycle.archive_on_fresh, archive non-preserved workspace files first so stale artifacts can't satisfy this run's validations. Use for self-chaining scores or re-running a completed score. (Editing the score file also triggers this automatically for completed scores.)"), require_lock=Option(None, '--require-lock', help="Admission gate: refuse unless this composition lock (written by the composing skill's release gate, check_score_release.py --write-lock) attests the exact score bytes. A missing, stale or malformed lock rejects the job with a specific reason. Omit for ordinary unlocked submission."), job_id=Option(None, '--job-id', help="Name this run. By default the job ID is the score's filename stem; --job-id lets one shipped score serve several commissions side by side without copying it. When the score sets no workspace:, the auto-managed workspace follows the job ID too (~/workspaces/<job-id>). Use the same ID with status, pause, resume and cancel."), var=Option(None, '--var', help="Per-invocation template variable as key=value (repeatable). Merges into the score's prompt.variables, overriding YAML on collision — so one generic score can be pointed at different inputs without editing the file. Values are strings; typed variables belong in YAML. Persisted across resume."))
Run a score from a YAML configuration file.
Source code in src/marianne/cli/commands/run.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
submit_score
async
¶
submit_score(config_file, *, workspace=None, fresh=False, self_healing=False, auto_confirm=False, start_sheet=None, escalation=False, runtime_vars=None, require_lock=None, job_id=None)
Validate, submit the score to the conductor, return the outcome.
The one submit path mzt run and mzt agents run both call (#561).
It validates the job id and the score, probes the conductor, routes
job.submit, polls briefly for an early failure, and returns a typed
value. It never prints and never raises typer.Exit; every refusal —
including an invalid job id or an unloadable score — is a returned
SubmitResult, and neither reaches the conductor.
The score check is conservative (:func:_score_load_error refuses only
what it can prove), and neither refusal is new for mzt run: run
refuses a bad --job-id and an invalid score in its own command body,
before it calls the adapter, so here those branches serve
mzt agents run, which calls this function directly.
Source code in src/marianne/cli/commands/run.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | |
render_submit_result
¶
Print a SubmitResult the way mzt run has always printed one.
Raises typer.Exit(1) for every outcome a caller cannot continue past.
Today the _try_daemon_submit adapter is its only caller: run and
_run_fleet both submit through it. The renderer stays synchronous, so
rejection_followup is how the adapter gets the rate-limit panel into
the output: it awaits the query (:func:_fetch_rate_limits_on_rejection)
before rendering, then hands the sync print (:func:_print_rate_limits)
in here, to run in text mode after the error and before the exit, which
is where mzt run has always shown it. It is called only for
REJECTED.
NOT_ROUTED is not rendered here: the adapter returns False for it
and the caller renders it through _report_conductor_unreachable.
Source code in src/marianne/cli/commands/run.py
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | |