Skip to content
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

verdi setup: forward broker defaults to interactive mode #4405

Merged
merged 1 commit into from
Sep 26, 2020

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Sep 26, 2020

Fixes #4404

The options for the message broker configuration do define defaults,
however, the interactive clones for verdi setup, which are defined in
aiida.cmdline.params.options.commands.setup override the default with
the contextual_default which sets an empty default, unless it is taken
from an existing profile. The result is that for new profiles, the
broker options do not specify a default, even though for most use cases
the defaults will be required.

The options for the message broker configuration do define defaults,
however, the interactive clones for `verdi setup`, which are defined in
`aiida.cmdline.params.options.commands.setup` override the default with
the `contextual_default` which sets an empty default, unless it is taken
from an existing profile. The result is that for new profiles, the
broker options do not specify a default, even though for most usecases
the defaults will be required.
@sphuber sphuber requested a review from ltalirz September 26, 2020 16:22
@codecov
Copy link

codecov bot commented Sep 26, 2020

Codecov Report

Merging #4405 into develop will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4405      +/-   ##
===========================================
+ Coverage    79.22%   79.23%   +0.01%     
===========================================
  Files          475      475              
  Lines        34826    34827       +1     
===========================================
+ Hits         27587    27590       +3     
+ Misses        7239     7237       -2     
Flag Coverage Δ
#django 73.07% <100.00%> (+0.01%) ⬆️
#sqlalchemy 72.29% <100.00%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/cmdline/params/options/commands/setup.py 94.74% <100.00%> (+0.06%) ⬆️
aiida/transports/plugins/local.py 81.54% <0.00%> (+0.26%) ⬆️
aiida/engine/daemon/runner.py 82.76% <0.00%> (+3.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dac8156...58f12a5. Read the comment docs.

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sphuber , I guess this is in response to the recent post to the AiiDA mailing list?

The changes look fine to me and I'm approving this, but you might still consider adding a test to check that new profiles have the right settings (i.e. a test that would catch the issue we saw on the mailing list).

Also, I found it not so easy to follow the slightly convoluted sentence structure in the commit message - here an alternative suggestion:

The `verdi setup` cli was overriding default values for the message broker
configuration with `None`, leading to a broken profile configuration.
This did not affect `verdi quicksetup`, where proper defaults were used.

@sphuber
Copy link
Contributor Author

sphuber commented Sep 26, 2020

Thanks @sphuber , I guess this is in response to the recent post to the AiiDA mailing list?

Not really. I haven't seen any post with respect to this? Which do you mean?

The changes look fine to me and I'm approving this, but you might still consider adding a test to check that new profiles have the right settings (i.e. a test that would catch the issue we saw on the mailing list).

It is not actually a problem with the created profiles, they are fine. It is just that when running verdi setup in interactive mode, the prompt won't provide a default for the broker settings, so the user will have to type it manually, even though the non-interactive version uses the correct default. So everything works fine, it is just a question of user-friendliness. After this change, 99/100 users can simply press enter for all broker options as the default will be just fine for their use case.

Also, I found it not so easy to follow the slightly convoluted sentence structure in the commit message - here an alternative suggestion:

The `verdi setup` cli was overriding default values for the message broker
configuration with `None`, leading to a broken profile configuration.
This did not affect `verdi quicksetup`, where proper defaults were used.

Maybe this has to do with the previous point, but this message is incorrect. There was no risk of broken profiles, just the prompt did not provide sensible defaults.

@sphuber sphuber merged commit ff30ebd into aiidateam:develop Sep 26, 2020
@sphuber
Copy link
Contributor Author

sphuber commented Sep 26, 2020

I have added an extra sentence to the commit message to make clarify that this just concerns the prompt displaying a proper default.

@sphuber sphuber deleted the fix/4404/setup-broker-defaults branch September 26, 2020 18:24
@ltalirz
Copy link
Member

ltalirz commented Sep 26, 2020

@sphuber
Copy link
Contributor Author

sphuber commented Sep 26, 2020

The mailing list: https://groups.google.com/g/aiidausers/c/mxW8NfRwVJM

Thanks. I don't think this is related. This exception is known to happen before the new broker configuration of v1.4. It is being discussed in this issue. So far we haven't been able to fully pin point the problem nor find a solution. I will respond to the mailing list with a link to the issue and ask if he can add his example.

sphuber added a commit to sphuber/aiida-core that referenced this pull request Sep 28, 2020
…#4405)

The options for the message broker configuration do define defaults,
however, the interactive clones for `verdi setup`, which are defined in
`aiida.cmdline.params.options.commands.setup` override the default with
the `contextual_default` which sets an empty default, unless it is taken
from an existing profile. The result is that for new profiles, the
broker options do not specify a default, even though for most usecases
the defaults will be required. After the changes of this commit, the
prompt of `verdi setup` will provide a default for all broker parameters
so most users will simply have to press enter each time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broker options do not suggest defaults in interactive mode of verdi setup
2 participants