acoustic-carpenter-78188
06/21/2026, 1:11 AM_run_remote. This folds it into the existing _Runner so run, rerun, recover, and (downstream) debug all share one with_runcontext-style API and all return a remote.Run.
Usage
Python
import flyte
flyte.init_from_config()
# Re-run a prior run with its exact inputs (fetches task + inputs from the platform — no local code):
flyte.rerun("ul56wcvgqrb9vzhzz5l2")
# Change input parameters (converted against the prior run's interface):
flyte.rerun("ul56wcvgqrb9vzhzz5l2", x_list=[1, 2, 3])
# Substitute new code, reusing the original inputs:
flyte.rerun("ul56wcvgqrb9vzhzz5l2", task_template=fixed_task)
CLI — flyte run (you have local code) and flyte rerun (fetch the run's code) are complementary:
flyte rerun ul56wcvgqrb9vzhzz5l2 # fetched code + prior inputs
flyte rerun ul56wcvgqrb9vzhzz5l2 --name retry --follow
flyte run main.py main --rerun-from ul56wcvgqrb9vzhzz5l2 # NEW local code + prior run's inputs
| command | code | inputs |
| -------------------------------- | ------- | ----------- |
| flyte run f t | local | CLI |
| flyte run f t --rerun-from <run> | local | prior run's |
| flyte rerun <run> | fetched | prior run's |
recover (coming soon)
recover (reuse a prior run's succeeded actions, re-run only what failed/changed) is a run-context knob — recover=True recovers from the run being rerun (rerun-only); a run-name string recovers a fresh run() from a named prior run; it's remote-only and recover=True on a plain run() raises. It's gated until the backend ships flyteidl2 RunSpec.recover (raises a clear `NotImplementedError`; one-line enable then).
The matching CLI flags — flyte rerun --recover and flyte run --recover-from <run> — are coming soon: omitted from the CLI for now (left as TODOs) until the backend lands, so they don't surface in the generated CLI docs. The Python with_runcontext(recover=...) field exists today (gated).
flyte.replay is removed — flyte.rerun is the verb.
What changed
• `_run_remote`'s back half is extracted into reusable _Runner helpers: _build_task_spec_from_template, _submit_remote (the only network call site), and _apply_overrides (the single place run-context maps onto a RunSpec — fresh build, or deep-copy-and-merge for rerun).
• New _Runner.rerun + `flyte.rerun`; new flyte rerun command and flyte run --rerun-from.
• Behavior-preserving: a characterization safety net (test_run_runspec_chars.py) pins the exact `CreateRunRequest`/`RunSpec` and passes unchanged across the refactor. Lazy imports kept (no import flyte startup regression).
Verification
~150 run-path unit tests green (mypy + ruff + codespell clean). E2E on demo (local SDK baked into the image via make dist): rerun reproduces a baseline exactly, changed-inputs takes effect, flyte run --rerun-from reuses prior inputs with local code.
🤖 Generated with Claude Code
flyteorg/flyte-sdkacoustic-carpenter-78188
06/22/2026, 6:28 PM