diff --git a/content/docs/command-reference/repro.md b/content/docs/command-reference/repro.md index b889dae7a8..60181d434d 100644 --- a/content/docs/command-reference/repro.md +++ b/content/docs/command-reference/repro.md @@ -44,11 +44,16 @@ files, intermediate or final results (except if the `--pull` option is used). By default, this command checks all [pipeline](/doc/command-reference/dag) stages to determine which ones have changed. Then it executes the corresponding -commands. [Stage](/doc/command-reference/run) outputs are deleted from the -workspace before executing the stage commands that produce them. +commands (`cmd` field of `dvc.yaml`). [Stage](/doc/command-reference/run) +outputs are deleted from the workspace before executing the stage +commands that produce them. + +For stages with multiple commands (having a list in the `cmd` field), commands +are run one after the other in the order they are defined. The failure of any +command will halt the remaining stage execution, and raises an error. There are a few ways to restrict what will be regenerated by this command: by -specifying stages as `targets`, or by using the `--single-item`, among other +specifying stages as `targets`, or by using `--single-item`, among other options. > Note that stages without dependencies are considered _always changed_, so @@ -161,7 +166,7 @@ up-to-date and only execute the final stage. - `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if all stages are up to date or if all stages are successfully executed, otherwise - exit with 1. The command defined in the stage is free to write output + exit with 1. The commands defined in the stage are free to write output regardless of this flag. - `-v`, `--verbose` - displays detailed tracing information. @@ -244,8 +249,8 @@ If we now run `dvc repro`, we should see this: ```dvc $ dvc repro Stage 'filter' didn't change, skipping -Running stage 'count' with command: - python process.py numbers.txt > count.txt +Running stage 'count': +> python process.py numbers.txt > count.txt Updating lock file 'dvc.lock' ``` @@ -281,8 +286,8 @@ of only the target (`count`) and following stages (none in this case): ```dvc $ dvc repro --downstream count -Running stage 'count' with command: - python process.py numbers.txt > count.txt +Running stage 'count': +> python process.py numbers.txt > count.txt Updating lock file 'dvc.lock' ``` @@ -306,5 +311,5 @@ $ dvc dag ``` > Note that using `dvc repro` without `--downstream` in the above example -> results in the execution of the target (`count`), and the preceeding stages +> results in the execution of the target (`count`), and the preceding stages > (only 'filter' in this case). diff --git a/content/docs/user-guide/dvc-files-and-directories.md b/content/docs/user-guide/dvc-files-and-directories.md index a4e1a54afe..737b400d42 100644 --- a/content/docs/user-guide/dvc-files-and-directories.md +++ b/content/docs/user-guide/dvc-files-and-directories.md @@ -132,7 +132,9 @@ stages: - performance.json training: desc: train your model - cmd: python train.py + cmd: + - pip install -r requirements.txt + - python train.py deps: - train.py - features @@ -151,7 +153,10 @@ stages: by the user with the `--name` (`-n`) option of `dvc run`. Each stage can contain the possible following fields: -- `cmd` (always present): Executable command defined in this stage +- `cmd` (always present): One or more commands executed by the stage (may + contain either a single value, or a list). Commands are executed sequentially + until all are finished or until one of them fails (see + [`dvc repro`](/doc/command-reference/repro) for details). - `wdir`: Working directory for the stage command to run in (relative to the file's location). If this field is not present explicitly, it defaults to `.` (the file's location).