-
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
Support multiline command? #4373
Comments
For the record:
this is already supported and will be passed as is to the shell (we use shell=True in Popen). I would keep it as is.
This looks great and I think it should behave like cmd1 && cmd2 && cmd3, meaning that if one command fails then the rest is not executed and results in a stage failure. |
I have started to look at the code. @efiop is it ok to add a |
Hi @ClementWalter ! Thanks for looking into it! What advantages/disadvantages do you see for doing a |
Keeping open for the question about multiline cmd handling raised by @skshetry |
Hi. I'm curious what's the use case for this. Is there a good example of multiple commands that share deps and outs? (to improve the docs) |
This is more of a convenience/ergonomical feature. So, anything you can write in a single line can be written in multiple lines or vice versa but might be easier than just cramming it in one with
You can use Github search for this (about usage of Here's a list of what I could find:
|
Thanks! I'm aware of POSIX Also thanks for the specific example ideas! I think that most of them may be better served by other forms thouogh:
Multiple stages
Stage groups (
setting several env vars seems like the only instance where this is really convenient, to avoid an ugly string full of
Initially I was assuming that would be the point of having several commands in a stage, since having each command have separate deps/outs and listing those in a single stage doesn't sound very clean (again, better to use 2 stages instead?) Although I suppose if the stages are parallel, it could be a nice use of this feature, along with a Anyway, my Q is answered. Will check with Ivan whether it's worth improving the docs for this. Thanks again! |
You are thinking of an ideal situation. I won't be creating a separate stage just to clean the logfile the script creates. It's a convenience feature.
How do you create a virtual environment and run the script with
Like I said, |
It all seems very hypothetical to me but yes, you may be right. It's nice to have this option anyway. |
All of the examples are from Github's search. How could that be hypothetical? |
Oh I meant not from DVC users. |
I guess, they are from DVC users since they come from Github repos that use DVC. |
Ah, I didn't realize those GitHub repos use DVC! I thought it was from generic repos. Will try to find some some of them... |
Too bad that
i.e. I can't actually search for So far I've been able to find one interesting example ( |
Here's the Julia example:
prepare:
foreach: ${models}
do:
cmd: >-
julia --project=prepare -e "using Pkg; Pkg.instantiate()" &&
julia --project=prepare \
prepare/main.jl data/train/rawdata/ data/train/prepared/${item.name}.h5 \
--patch-stride ${item.data.patch_stride} \
--patch-size ${item.data.patch_size} \
--augment-times ${item.data.augment_times}
deps:
- data/train/rawdata
- prepare
outs:
- data/train/prepared/${item.name}.h5 I'm thinking of |
@johnnychen94, we do support list now if you are using from the So, you could write that as: cmd:
- julia --project=prepare -e "using Pkg; Pkg.instantiate()"
- julia --project=prepare \
prepare/main.jl data/train/rawdata/ data/train/prepared/${item.name}.h5 \
--patch-stride ${item.data.patch_stride} \
--patch-size ${item.data.patch_size} \
--augment-times ${item.data.augment_times} I see that you use cmd:
- julia --project=prepare -e "using Pkg; Pkg.instantiate()"
- >-
julia --project=prepare
prepare/main.jl data/train/rawdata/ data/train/prepared/${item.name}.h5
--patch-stride ${item.data.patch_stride}
--patch-size ${item.data.patch_size}
--augment-times ${item.data.augment_times} |
@jorgeorpinel, I use a simple script to fetch all the files matching a query using Github's token and search locally. There aren't that many, so should be quick. Try the script in |
Thanks for sharing your real like example @johnnychen94 ! I'm not familiar with Julia so forgive me if this is obvious but why do you run I'll try your script and lyk @skshetry! Thanks |
There are no standard rules about it. It's doable but I deliberately kept them apart because I think the environment initialization part has nothing to do with the real code. We normally run the real code multiple times (for developing or debugging purposes) while only initialize the environment once. This is also something that the whole Julia community tries to commit when dealing with CI. For example: https://github.com/JuliaImages/juliaimages.github.io/blob/cbd83915f5dfb0259fedaa3d1d14c67f34d983eb/.travis.yml#L14-L16 |
Implements an approach proposed by @skshetry. Fixes iterative#4373
Something like done in Github actions with run and script?
Or, perhaps:
Or, maybe both?
Need to double check if we will be able to keep the dump in this shape or form.
Why?
Better expression
Current Workaround:
The text was updated successfully, but these errors were encountered: