Skip to content

Clone a run - Cloud and Local - SDK and CLI#318

Merged
sebastian-quintero merged 13 commits into
developfrom
feature/eng-7345-clone-a-run-with-the-clipython-sdk
Jun 1, 2026
Merged

Clone a run - Cloud and Local - SDK and CLI#318
sebastian-quintero merged 13 commits into
developfrom
feature/eng-7345-clone-a-run-with-the-clipython-sdk

Conversation

@sebastian-quintero
Copy link
Copy Markdown
Member

Description

Introduces functionality for cloning a run in cloud and local:

  • SDK: new methods for interacting with the cloud module ➡️ cloud.Application.clone_run and cloud.Application.clone_run_with_result.
  • SDK: new methods for interacting with the localmodule ➡️ local.Application.clone_run and local.Application.clone_run_with_result.
  • CLI: new commands for cloning runs ➡️ nextmv cloud run clone and nextmv 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 metadata and find metadata to be a nested field that is part of that object. In the SDK, the complete object has always been called RunInformation. Following this, I am proposing we move away from metadata methods in favor of information methods. These are the following features that are being deprecated:

  • SDK: cloud.Application.run_metadata in favor of cloud.Application.run_information.
  • SDK: local.Application.run_metadata in favor of local.Application.run_information.
  • CLI: nextmv cloud run metadata in favor of nextmv cloud run information.
  • CLI: nextmv local run metadata in favor of nextmv local run information.

Last but not least, missing information in the actual run metadata was completed, such as options, execution_class, and others...

@sebastian-quintero sebastian-quintero self-assigned this May 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_result for cloud and local applications; add run_information and deprecate run_metadata.
  • CLI: add nextmv cloud run clone + nextmv local run clone, and add run information commands while deprecating run 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_kwarg now checks if stdin: (truthiness) instead of if 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_kwarg now checks if stdin: (truthiness) instead of if 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.

Comment thread nextmv/nextmv/local/runner.py
Comment thread nextmv/nextmv/run.py
Comment thread nextmv/nextmv/run.py Outdated
Comment thread nextmv/nextmv/cloud/application/_run.py
Comment thread nextmv/nextmv/local/application.py
Comment thread nextmv/nextmv/run.py Outdated
Comment thread nextmv/nextmv/cloud/application/_run.py
Comment thread nextmv/nextmv/local/application.py
Comment thread nextmv/nextmv/cli/local/run/create.py
Comment thread nextmv/nextmv/cli/cloud/run/clone.py Outdated
Copy link
Copy Markdown
Member

@merschformann merschformann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 😊

Comment thread nextmv/nextmv/local/application.py Outdated
Comment thread nextmv/nextmv/local/runner.py Outdated
Comment thread nextmv/nextmv/run.py
@merschformann
Copy link
Copy Markdown
Member

@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. ☺️

@sebastian-quintero
Copy link
Copy Markdown
Member Author

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. 😊

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 metadata and other info is at the "root", like name... At least now we have a very clear distinction between information and metadata.

@sebastian-quintero sebastian-quintero merged commit d062637 into develop Jun 1, 2026
54 checks passed
@sebastian-quintero sebastian-quintero deleted the feature/eng-7345-clone-a-run-with-the-clipython-sdk branch June 1, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants