Clone a run - Cloud and Local - SDK and CLI#318
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds “clone run” support across the SDK (cloud + local) and CLI, and standardizes the “run metadata” concept by introducing run_information APIs/commands while deprecating run_metadata. It also expands the run information schema to include additional runtime fields (options, queuing, integration, execution details, etc.).
Changes:
- SDK: add
clone_run/clone_run_with_resultfor cloud and local applications; addrun_informationand deprecaterun_metadata. - CLI: add
nextmv cloud run clone+nextmv local run clone, and addrun informationcommands while deprecatingrun metadata. - Model/schema: extend
nextmv.run.Metadata(options, queuing, integration, execution fields) and add new option/integration types.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| nextmv/tests/local/test_application.py | Updates local tests to use run_information and patches accordingly. |
| nextmv/tests/integration/cloud/test_integration_cloud.py | Adds an integration step covering cloud run cloning flows. |
| nextmv/nextmv/run.py | Extends run models (options/integration/etc.) and adds content_format helper + new types. |
| nextmv/nextmv/local/runner.py | Records richer local run metadata (options, tracking, queuing, format). |
| nextmv/nextmv/local/executor.py | Updates local run info to include execution_duration. |
| nextmv/nextmv/local/application.py | Adds local clone_run*, introduces run_information, and deprecates run_metadata. |
| nextmv/nextmv/input.py | Adjusts option resolution timing during Input.load. |
| nextmv/nextmv/deprecated.py | Introduces NextmvDeprecationWarning and updates warning emission behavior. |
| nextmv/nextmv/cloud/application/_run.py | Adds cloud clone_run*, introduces run_information, refactors run submission into __new_run, deprecates run_metadata. |
| nextmv/nextmv/cli/mcp/tools/run.py | Switches MCP “cloud run status” to run_information and minor formatting changes. |
| nextmv/nextmv/cli/mcp/tools/local.py | Switches MCP local run status/result validation to run_information and minor formatting changes. |
| nextmv/nextmv/cli/main.py | Suppresses SDK deprecation warnings for CLI execution. |
| nextmv/nextmv/cli/local/run/metadata.py | Deprecates local CLI run metadata and prints a deprecation warning. |
| nextmv/nextmv/cli/local/run/input.py | Uses run_information to determine input format behavior. |
| nextmv/nextmv/cli/local/run/information.py | Adds nextmv local run information command. |
| nextmv/nextmv/cli/local/run/get.py | Uses run_information and avoids trimming empty assets. |
| nextmv/nextmv/cli/local/run/create.py | Allows “no input” in shared helper (for cloning) and updates examples. |
| nextmv/nextmv/cli/local/run/clone.py | Adds nextmv local run clone command. |
| nextmv/nextmv/cli/local/run/init.py | Registers new clone and information subcommands. |
| nextmv/nextmv/cli/cloud/run/metadata.py | Deprecates cloud CLI run metadata and prints a deprecation warning. |
| nextmv/nextmv/cli/cloud/run/input.py | Uses run_information to determine input format behavior. |
| nextmv/nextmv/cli/cloud/run/information.py | Adds nextmv cloud run information command. |
| nextmv/nextmv/cli/cloud/run/get.py | Uses run_information and avoids trimming empty assets. |
| nextmv/nextmv/cli/cloud/run/create.py | Allows “no input” in shared helper (for cloning). |
| nextmv/nextmv/cli/cloud/run/clone.py | Adds nextmv cloud run clone command and run-configuration overrides. |
| nextmv/nextmv/cli/cloud/run/init.py | Registers new clone and information subcommands. |
| nextmv/nextmv/init.py | Exposes new run model types at package top-level. |
Comments suppressed due to low confidence (2)
nextmv/nextmv/cli/cloud/run/create.py:526
resolve_input_kwargnow checksif stdin:(truthiness) instead ofif stdin is not None. If the user pipes an empty input (after.strip()), this will be treated as “no stdin”, potentially returning{}and leading to confusing downstream behavior.
# It is possible to not provide any input when we are cloning a run.
if stdin is None and input is None and managed_input_id is None:
return {}
if stdin:
# Handle the case where stdin is provided as JSON for a JSON app.
try:
input_data = json.loads(stdin)
except json.JSONDecodeError:
input_data = stdin
return {"input": input_data}
nextmv/nextmv/cli/cloud/run/create.py:526
resolve_input_kwargnow checksif stdin:(truthiness) instead ofif stdin is not None. If the user pipes an empty input (after.strip()), this will be treated as “no stdin”, potentially returning{}and leading to confusing downstream behavior.
# It is possible to not provide any input when we are cloning a run.
if stdin is None and input is None and managed_input_id is None:
return {}
if stdin:
# Handle the case where stdin is provided as JSON for a JSON app.
try:
input_data = json.loads(stdin)
except json.JSONDecodeError:
input_data = stdin
return {"input": input_data}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
merschformann
left a comment
There was a problem hiding this comment.
Looks good, no major comments. Feel free to ignore them, so, already 🟢 it. Thanks for the work! 🤗
Regarding the metadata -> information rename, I am fine with that, though, it does drift from the API endpoint name (...runs/{run_id}/metadata). However, it is odd that it has nested metadata and for a CLI user it's likely nicer.
We need to remember to align nextpipe too though. 😊
|
@sebastian-quintero : We need to check why smoketest is suddenly failing on Windows. Ping me if you need help around testing / finding the issue on Windows. |
I think it is fine to drift from the API as long as it proves useful and makes more sense. I always found it confusing that some information is under |
Description
Introduces functionality for cloning a run in
cloudandlocal:cloudmodule ➡️cloud.Application.clone_runandcloud.Application.clone_run_with_result.localmodule ➡️local.Application.clone_runandlocal.Application.clone_run_with_result.nextmv cloud run cloneandnextmv local run clone.Deprecates some features. Largely, when run "metadata" is requested, it always comes back to the user as:
{ "description": "", "id": "latest-6O8pEx1vg", "metadata": { "application_id": "2005", "application_instance_id": "latest", ... }, "name": "", ... }It has always been confusing to get
metadataand findmetadatato be a nested field that is part of that object. In the SDK, the complete object has always been calledRunInformation. Following this, I am proposing we move away frommetadatamethods in favor ofinformationmethods. These are the following features that are being deprecated:cloud.Application.run_metadatain favor ofcloud.Application.run_information.local.Application.run_metadatain favor oflocal.Application.run_information.nextmv cloud run metadatain favor ofnextmv cloud run information.nextmv local run metadatain favor ofnextmv local run information.Last but not least, missing information in the actual run metadata was completed, such as
options,execution_class, and others...