Skip to content

Feature: Support spinning a single metaflow step (Rebased)#2506

Merged
talsperre merged 21 commits into
masterfrom
dev/spin-rec-rebased
Oct 22, 2025
Merged

Feature: Support spinning a single metaflow step (Rebased)#2506
talsperre merged 21 commits into
masterfrom
dev/spin-rec-rebased

Conversation

@talsperre

Copy link
Copy Markdown
Collaborator

To test spin on a new flow you can do the following:

Simple case:

python <flow_name.py> --environment=conda spin <step_name>

Pass in specific pathspec:

python runtime_dag_flow.py --environment=conda spin --spin-pathspec RuntimeDAGFlow/13/step_c/275232971

Pass in custom artifacts via module:

python runtime_dag_flow.py spin --spin-pathspec RuntimeDAGFlow/13/step_d/275233082 --artifacts-module ./my_artifacts.py

Skip decorators (including the whitelisted ones):

python complex_dag_flow.py --environment=conda spin step_d --skip-decorators

Use with Runner API:

    with Runner('complex_dag_flow.py', environment="conda").spin(
        step_name,
        spin_pathspec="<Some Val>",
        artifacts_module='./artifacts/complex_dag_step_d.py',
    ) as spin:
        print("-" * 50)
        print(f"Running test for step: step_a")
        spin_task = spin.task
        print(f"my_output: {spin_task['my_output']}")
        assert spin_task['my_output'].data == [-1]

See the tests for more examples on hot to use this command.

Comment thread metaflow/datastore/task_datastore.py Outdated
Comment thread metaflow/datastore/content_addressed_store.py
Comment thread metaflow/datastore/flow_datastore.py Outdated
Comment thread metaflow/util.py Outdated
Comment thread metaflow/util.py Outdated
Comment thread metaflow/task.py Outdated
# queries on that same TaskDatastore will be quick (since we already
# have all the metadata)
self._task_metadata_caches = OrderedDict()
# have all the metadata). We keep track of this in a file so it persists

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder if same should be done for self._store_caches? which is right now an OrderedDict

Comment thread metaflow/client/core.py
Comment thread metaflow/client/core.py Outdated
Comment thread metaflow/client/core.py Outdated
Comment thread metaflow/runtime.py Outdated
Comment thread metaflow/cli_components/run_cmds.py Outdated
Comment thread metaflow/cli_components/step_cmd.py Outdated
Comment thread metaflow/cli_components/step_cmd.py
Comment thread metaflow/runner/metaflow_runner.py Outdated
Comment thread metaflow/runner/metaflow_runner.py Outdated
Comment thread metaflow/runner/metaflow_runner.py Outdated
Comment thread metaflow/runner/metaflow_runner.py Outdated
Comment thread metaflow/runner/metaflow_runner.py Outdated
Comment thread metaflow/runner/metaflow_runner.py Outdated
@talsperre
talsperre force-pushed the dev/spin-rec-rebased branch from 4e80bfa to 94aa6d6 Compare August 25, 2025 07:40
@talsperre
talsperre force-pushed the dev/spin-rec-rebased branch 3 times, most recently from e785d31 to 4d0ad94 Compare September 4, 2025 01:02

@romain-intel romain-intel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some smallish comment with maybe a small concern around the transfer of artifacts.

Comment thread metaflow/cli.py Outdated
Comment thread metaflow/cli.py Outdated
Comment thread metaflow/cli_components/run_cmds.py
Comment thread metaflow/cli_components/run_cmds.py
Comment thread metaflow/cli_components/run_cmds.py Outdated
Comment thread metaflow/datastore/flow_datastore.py Outdated
Comment thread metaflow/datastore/flow_datastore.py Outdated
Comment thread metaflow/datastore/task_datastore.py Outdated
Comment thread metaflow/datastore/content_addressed_store.py
Comment thread metaflow/datastore/content_addressed_store.py
Comment thread metaflow/client/core.py Outdated
@talsperre
talsperre force-pushed the dev/spin-rec-rebased branch 3 times, most recently from 241af68 to 3a36e8b Compare October 21, 2025 20:04
@talsperre
talsperre merged commit ee68f27 into master Oct 22, 2025
33 checks passed
@talsperre
talsperre deleted the dev/spin-rec-rebased branch October 22, 2025 16:11
talsperre added a commit that referenced this pull request May 31, 2026
)

## Summary

Remove duplicate `--use-latest` pytest option registration that prevents
the unit test suite from collecting.

## Problem

Running `pytest test/unit/` fails during collection with:

```
ValueError: option names {'--use-latest'} already added
```

`--use-latest` is registered in both `test/unit/conftest.py` (added in
#3040) and `test/unit/spin/conftest.py` (from #2506). pytest raises on
the duplicate.

## Fix

Remove `pytest_addoption` from `test/unit/spin/conftest.py`. The root
`test/unit/conftest.py` already registers the option and it applies to
all subdirectories.

## Testing

| State | Result |
|-------|--------|
| Before | `pytest test/unit/` fails with collection error |
| After | 468 passed, 1 failed, 19 skipped, 21 errors |

> **Note:** The 1 failure (`complex_dag`) and 21 errors
(`secrets`/`system_context` tests) are pre-existing infrastructure
issues unrelated to this change.

---------

Co-authored-by: Shashank Srikanth <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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