Synopsis
Description
Thedvc run command was used in earlier versions of DVC to create pipeline stages. It has been superseded by the more explicit and feature-rich dvc stage add command.
Why was it deprecated?
- Clearer semantics:
dvc stage addmakes it explicit that you’re adding a stage to a pipeline - Better subcommand structure: The
dvc stagecommand groups related functionality (add, list, etc.) - Improved consistency: Aligns with DVC’s overall command structure
- Same functionality: All features from
dvc runare available indvc stage add
Migration Guide
Migrating fromdvc run to dvc stage add is straightforward - the syntax is almost identical:
Basic command migration
Old syntax (dvc run):Simply replace
dvc run with dvc stage add. All flags and options remain the same.Complete migration examples
Example 1: Data preprocessing
Old:Example 2: Model training with parameters
Old:Example 3: Evaluation with plots
Old:Option Mapping
All options fromdvc run are supported in dvc stage add:
| Flag | Purpose | Status |
|---|---|---|
-n, --name | Stage name | ✅ Same |
-d, --deps | Dependencies | ✅ Same |
-o, --outs | Outputs (cached) | ✅ Same |
-O, --outs-no-cache | Outputs (not cached) | ✅ Same |
-p, --params | Parameter dependencies | ✅ Same |
-m, --metrics | Metrics outputs | ✅ Same |
-M, --metrics-no-cache | Metrics (not cached) | ✅ Same |
--plots | Plot outputs | ✅ Same |
--plots-no-cache | Plots (not cached) | ✅ Same |
-f, --force | Overwrite existing stage | ✅ Same |
-w, --wdir | Working directory | ✅ Same |
--always-changed | Always run stage | ✅ Same |
--desc | Stage description | ✅ Same |
Automated Migration
If you have scripts or CI/CD pipelines usingdvc run, you can quickly migrate them:
Using find and replace
Updating Makefiles
Before:Updating CI/CD configurations
GitHub Actions (before):Frequently Asked Questions
Will my existing pipelines break?
No. Thedvc run command created stages in dvc.yaml files using the same format that dvc stage add creates. Your existing pipeline files will continue to work with all DVC commands.
Do I need to recreate my pipelines?
No. Only the command to create stages has changed. Your existing stages indvc.yaml don’t need any modifications.
Is dvc run completely removed?
While deprecated,dvc run may still work in some versions for backward compatibility. However, it’s recommended to migrate to dvc stage add as support will eventually be removed.
What about dvc.lock files?
Thedvc.lock file format is unchanged. Both dvc run and dvc stage add produce identical lock files.
See Also
- dvc stage add - Create pipeline stages (recommended)
- dvc stage list - List existing stages
- dvc repro - Reproduce pipelines
- dvc dag - Visualize pipeline structure