-
Notifications
You must be signed in to change notification settings - Fork 224
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
Fix bug in verdi daemon restart --reset
#3969
Fix bug in verdi daemon restart --reset
#3969
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3969 +/- ##
===========================================
+ Coverage 78.33% 78.44% +0.10%
===========================================
Files 461 461
Lines 34076 34077 +1
===========================================
+ Hits 26694 26731 +37
+ Misses 7382 7346 -36
Continue to review full report at Codecov.
|
bfaf1a1
to
f374f9b
Compare
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.
I left a comment with a doubt (but if you know it works, it's ok to merge), and a typo (feel free to fix it)
# Due to that bug, the `callback` of the `number` argument the `start` command is not being called, which is | ||
# responsible for settting the default value, which causes `None` to be passed and that triggers an exception. | ||
# As a temporary workaround, we fetch the default here manually and pass that in explicitly. | ||
number = ctx.obj.config.get_option('daemon.default_workers', ctx.obj.profile.name) |
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.
Just to double check, ctx.obj.profile.name
is always set even if not explicitly specified?
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.
Barring a bug, it should be. It is set in aiida.cmdline.commands.cmd_verdi.verdi
The command `verdi daemon restart --reset` was excepting when it was invoking the `verdi daemon start` command. The reason being that recently the `number` argument of `verdi daemon start` was changed to not define a default directly, but to go through a callback. This would then set the default based on a configuration option for the current profile. However, due to a bug in `click`, parameter callbacks are not called when invoking a command through `Context.invoke`, which caused the `number` argument to be `None` which triggered an exception. Until that bug is fixed in `click`, which has issue aiidateam#950, we add a workaround to manually defining the default value, that would normally have been done by the argument callback, and explicitly passing it in the invoke call.
f374f9b
to
7a111dd
Compare
Fixes #3960
The command
verdi daemon restart --reset
was excepting when it wasinvoking the
verdi daemon start
command. The reason being that recentlythe
number
argument ofverdi daemon start
was changed to not definea default directly, but to go through a callback. This would then set
the default based on a configuration option for the current profile.
However, due to a bug in
click
, parameter callbacks are not calledwhen invoking a command through
Context.invoke
, which caused thenumber
argument to beNone
which triggered an exception. Until thatbug is fixed in
click
, which has issue #950, we add a workaround tomanually defining the default value, that would normally have been done
by the argument callback, and explicitly passing it in the invoke call.
N.B.: I opened a PR that fixes the underlying bug in
click
.