-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stage add
: insert stages mid-dvc.yaml (via --force
)
#6171
Comments
Hi @BradyJ27
This is not exactly the case. You can insert stages with
The order in which they are presented in dvc.yaml is not important for DVC, only the way in which they connect (the dependency graph or DAG). But for your own benefit you can easily edit dvc.yaml so it's more readable to you if you prefer. Does that clarify the situation? |
Thank you for your response @jorgeorpinel ! This does clarify. I'm still thinking there might be some room for a feature here, maybe even something as small as rearranging the yaml file for readability. Any thoughts on making this into something or is this unnecessary? Thanks again! |
An idea would be to move overwritten stages ( |
stage add
: insert stages mid-dvc.yaml (via --force
)
Good idea! I'm thinking either moving forced stages to the bottom (like you said). Or moving stages based on dependencies and outputs. I will update the issue description. |
|
Def. agree. But I did notice that |
Not really.
We used to this before. See #4003 for the motivation to preserving order. But open to discussion for the change. |
I see so if this is dependent on the implementation and that's how structures are handled by default by Python then that's probably the best behavior to keep. So is this request valid, or should we decide not to go this route? After all it's unclear where to put stages that will be considered ideal in all cases, and users can always reorder the YAML structure manually. |
As of right now, if you want to insert a new stage between two existing stages in a DVC pipeline, you must either edit the .yaml manually or remake the pipeline completely. See Discord discussion https://discord.com/channels/485586884165107732/485596304961962003/854010209596473364
My proposed feature it something along the lines of either:
dvc stage add --location
where location is the stage number you want it to be. E.g. if I have stages:x, y, z
and I dodvc stage add -n t --location 2
the stages would now bex, t, y, z
OR
dvc stage insert
where you could insert a stage into an already existing pipeline.Any thoughts/improvements are much appreciated.
Edit:
After further discussion, this is possible. The steps are
dvc stage add
and redefine the following stage withdvc stage add --force
. Currently the .yaml file does not get updated, and the new stage gets added to the end. The desired behavior is the .yaml file to be either in order based on dependencies and outputs, OR overwriten stages should be moved to the bottom of the yaml file.The text was updated successfully, but these errors were encountered: