-
Notifications
You must be signed in to change notification settings - Fork 34
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
Adding a --engine-options option to the CLI #205
Conversation
This allows to specify a dictionary (as a JSON string) to add more content to each of the engines. Example usage and usecase: `--engine-options='{"account": "mr0"}'` when, in order to run, you are required to specify an account. This to me seems a still general enough approach, and important (without it I cannot run so the CLI is not very useful to me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @giovannipizzi . Indeed useful if not necessary option to have. Just one question about the design and some implementation suggestions. Also, some minimal tests would be good. See tests/cli/test_options.py:TestStructureDataParamType
.
Why don't we force the passed dictionary to be exactly the dictionary accepted by
Just now maybe everything is optional and the info here are overridden if |
Thanks @bosonie that's a lot clearer way of putting what I also suggested 😅 Seems we are both on the same page then at least, Edit: reading it a bit more closely, there might be a slight difference in what we are suggesting. I think it should match the exact namespace structure, but I think it should only override the |
I do not understand this. |
What I mean is that you won't be able to use the
i.e. you cannot have literal python code to define nodes. Of course we could think of allowing identifiers such as the pk or UUID and we load those for the corresponding nodes. Anyway, the question is do we have this format:
And directly overlay that on the actual inputs, so that is why it has to have the
and then those options are simply applied to all the engines. |
Co-authored-by: Sebastiaan Huber <mail@sphuber.net>
Thanks for the review. I also thought about this (and admittedly I only thought to my use case ;-) ). I would go for a compromise:
i.e., we now specify one key-value pair per engine, BUT only for the metadata.options part What do you think? |
Makes perfect sense. I think the most important thing is to give a concrete example in the help string of the format that is expected. Thinking about it now: since most plugins have just a single engine, for most cases, this requires additional (unnecessary) writing of a dictionary. The best solution for flexibility and usability would be to make it optional to type the explicit engine. Even when there are two, we might just accept directly the options, in which case we apply them to all. The only tricky part is the validation and just by looking at the string determine whether the engine keys are specified or not. Hypothetically there could be some overlap between valid option names and engine names, but I think those chances are minimal. Instead of a generic |
Ok. Agreed! |
Now it must be a dictionary, one item per engine type. Documentation (helpstring) clarified with one example.
I think that the added complexity of always adding "relax" even if it's only one is acceptable (the logic would start to become complex, and as you say there's risk of overlapping keys. |
I should have fixed my tests. Any idea of why the others are failing? (It's also hard for me to check - even when I did a mistake my tests were running locally - even the failed ones - while a test from aiida_castep was failing. Not sure what's going on... |
@giovannipizzi those failures are due to a bug in the fixtures that surfaced after an update in |
Thanks @giovannipizzi |
This allows to specify a dictionary (as a JSON string) to
add more content to each of the engines.
Example usage and usecase:
--engine-options='{"account": "mr0"}'
when, in order to run, you are required to specify an account.
This to me seems a still general enough approach, and important
(without it I cannot run so the CLI is not very useful to me).