`stage`: list/show/get stage details
CLI command and API method to get all stage info (cmd, params, deps, outs, etc.).
- CLI command is useful for seeing the resolved info for stages using interpolation
- API method is useful for getting paths so you don't have to manually align them between code and dvc.yaml
Loosely related to https://github.com/iterative/vscode-dvc/issues/5048:
With a complicated DVC pipeline, with dynamic parametrized dependencies it's not easy to get an exact command that is needed to run a specific stage under debugger outside of DVC.
Example:
$ cat dvc.yaml
stages:
train:
cmd: python src/train.py ${data_path}/features ${model_path} ${train}
deps:
- ${data_path}/features
- src/train.py
params:
- train
outs:
- ${model_path}
- dvclive:
cache: false
$ dvc stage show train --json
{
"cmd": "python src/train.py data/features model.pkl min_split=0.2 n_est=50 seed=101",
"deps": [
"data/features",
"model.pkl"
],
"params": {
"train": {
"min_split": 0.2,
"n_est": 50,
"seed": 101,
}
},
"outs": {
"model.pkl": {},
"dvclive": {"cache": false}
}
}
API usage:
from dvc.api import stage_show
outs = stage_show("train").outs
with open(outs[0].path, "w") as f:
f.write(model)
@iterative/vs-code How can we show the resolved stages in the extension so it's easy to edit and debug dvc.yaml?
Maybe we could show stages in a tree in a sidebar view.
@julieg18 I was initially thinking along the lines of the ideas in https://github.com/iterative/vscode-dvc/issues/1192, but maybe a dedicated sidebar view like you suggest is better 🤔.