-
Notifications
You must be signed in to change notification settings - Fork 192
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
add non-zero exit code for verdi daemon status #3729
Conversation
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 think we should add at least one unit test for this. Are you sure this works as intended? The client.get_status()
always returns a dictionary, if daemon is running:
{
'status': 'active',
'time': 1580203422.571316,
'id': '10a66cd1592a44869cd632a059aab974'
}
and if it is not:
{'status': 'daemon-error-not-running'}
So I think this command currently will always exit with 1
99acada
to
289b458
Compare
Thanks for paying attention - I actually planned doing what I did now, no idea what I was thinking... |
289b458
to
5817e9e
Compare
`verdi daemon status` was always returning exit code 0, which makes it difficult to use the command programmatically (e.g. in ansible). It now returns exit code 1 if the daemon of any of the requested profiles is not running.
5817e9e
to
0fd706d
Compare
aiida/cmdline/commands/cmd_daemon.py
Outdated
"""Print the status of the current daemon or all daemons.""" | ||
"""Print the status of the current daemon or all daemons. | ||
|
||
Returns exit code 0 if all daemons are running, else exit code 3. |
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.
Could you please clarify that "all daemons" refers to "all daemons whose status is requested" and not "daemons of all profiles", i.e., if one does not specify --all
then 0 is returned when the current default daemon/profile is running, even if any other daemon is not running
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.
sure, done!
0fd706d
to
74221b3
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.
Thanks @ltalirz
fixes #3728
verdi daemon status
was always returning exit code 0, which makes itdifficult to use the command programmatically (e.g. in ansible).
It now returns exit code 1 if the daemon of any of the requested
profiles is not running.