-
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 name incorrectly parsed with parametrization for dict #4957
Comments
@johnnychen94, this is not supported. List in Can you refactor it to use dict than a list: stages:
build:
foreach:
level1:
level: 15
level2:
level: 35
do:
cmd: echo ${item.level} |
Good to know the alternative and yes it works. # dvc.yaml
stages:
build:
foreach: ${models}
do:
cmd: "echo type: ${item.noise_type} level: ${item.noise_level}" # params.yml
models:
model_1:
noise_type: "gaussian"
noise_level: 15
model_2:
noise_type: "gaussian"
noise_level: 25 jc@mathai3:~/Downloads/dvc_test$ dvc repro --dry -f
Running stage 'build@model_1' with command:
echo type: gaussian level: 15
Running stage 'build@model_2' with command:
echo type: gaussian level: 25
Use `dvc push` to send your updates to remote storage. Should I update the wiki? I guess this is something that people will occasionally hit because it's simpler to write # params.yml
models:
- noise_type: "gaussian"
noise_level: 15
- noise_type: "gaussian"
noise_level: 25 |
Hi, @johnnychen94. I created #4961 to fix this issue, but I still recommend using dictionary for better experience.
I'd still like to keep this issue open for future considerations, so please don't consider it as officially supported yet. |
@johnnychen94 , Coming to this again, would generating stages as Thanks. |
sounds good to me. Is the id order guaranteed, I guess not? |
@johnnychen94, good question. I think it's good to assume list as ordered and generate on the basis of that index, what do you think? We could also do that on the basis of its content, but it'll complicate internals (which might require hashing?) and making it that way, DVC won't be able to work if you change/update any item inside. I think this is more suitable for a dictionary. Another question, should it be 0-indexed or 1-indexed? 😄 |
I believe our current parametrization workflow does not (and should not) rely on the index order, so perhaps some careful documentation on this would be sufficient, e.g., "the index order is undefined and depends on internal implementation". I can't foresee what extra benefits hash could give us compared to the simple list order. So might be a good enough reason to stick to the simple version.
As far as it's well documented, it doesn't matter much for me. I know that there are people who dislike another language because it uses 1-indexed but that makes no sense to me. I prefer this to be 0-indexed because it might be better for future job scheduling tasks. For example, suppose that we have 20 jobs, then with the glob feature #4976 we could split it into two balanced batches: Another example that 0-indexed might help, is that nvidia devices are ordered by 0-indexed (pcie bus order), so it can be convenient to schedule the first job |
minor refactors, code comments Rename interim to definitions provide location of entry during init for definition small fixups to set_temporarily Refactor loop to use dict comprehension Provide same interface for definitions Make it work for composite lists Check for sequence rather than a list refactor tests Fixes iterative#4955 Fixes iterative#4957 Fixes iterative#4963
minor refactors, code comments Rename interim to definitions provide location of entry during init for definition small fixups to set_temporarily Refactor loop to use dict comprehension Provide same interface for definitions Make it work for composite lists Check for sequence rather than a list refactor tests Fixes #4955 Fixes #4957 Fixes #4963
Bug Report
Please provide information about your setup
List version works:
However, the dict version doesn't
According to the error output, I guess the stage name is incorrectly parsed somewhere. I tried to look at the source code but failed to find a clue.
Output of
dvc version
:The text was updated successfully, but these errors were encountered: