-
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
CLI: interface for manully clean stale PID file #6007
CLI: interface for manully clean stale PID file #6007
Conversation
Thanks @unkcpz . When I refactored the daemon implementation, it was a request of @ltalirz to only have stale PID files be cleaned when starting the daemon. I agree though, that when this message is shown when asking the daemon status, it makes sense to me as well to resolve it by stopping the daemon. I believe the main problem @ltalirz had with the original implementation was that the PID was cleaned when asking the status as well. Which would be an unexpected side-effect for a status command. But I would argue that it makes sense for both starting and stopping the daemon. So how about, instead of adding a new dedicated command, we just have stopping the daemon also clean stale PID files? Would that work for you @unkcpz and @ltalirz ? |
That sounds reasonable to me as well, thanks Seb |
841e0d2
to
210ed38
Compare
for more information, see https://pre-commit.ci
Thanks @sphuber, it is even better for me. Then we just need to bump the aiida-core version in aiidalab-docker-stack. I update this PR. |
@unkcpz Please make sure to make the change in the |
Yes it is in |
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 @unkcpz
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.
Actually, sorry. I think we should also update the warning message if the stale PID is found. Now it suggest to start the daemon. I think suggesting to stop it makes more sense, or at least to suggest running either. As either will solve the problem now.
@sphuber thanks! |
I am indeed planning to release this with v2.3.1, but that is blocked by #6000 . As soon as that is merged, I can make the release. It has already been reviewed by @chrisjsewell but I needed to add one more commit, because it turns out that the refactoring of v2.0 broke the mechanism for any new migrations. They would work but not actually be committed. |
The daemon client was recently refactored to only clean the stale PID file in the `start_daemon` command. Before it was done when asking the status which was considered an unexpected side-effect. Sometimes, the user wants to make sure the daemon is no longer running. Currently, the status would raise a warning if a stale PID file is found suggesting the user to start the daemon to fix it. However, this is counterintuitve and not desirable if the goal is for the daemon to be stopped. The `stop_daemon` method is updated to also clean any potentially stale PID files. The error message is updated to suggest to either start or stop the daemon to return it to a nominal state. Co-authored-by: Sebastiaan Huber <mail@sphuber.net> Cherry-pick: 2bfc3c6
In 8d963c9 orphaned PID files can now only be removed by starting the daemon again. In order to provide a way to clean the stale pid file manually. In AiiDAlab docker stack, we run
verdi daemon stop
before database migration. But if the container is shut down ungracefully, the daemon is not properly stopped and leaves a stale PID file which causes the exception when runningverdi daemon stop
next time.With the CLI interface in this PR, it allows running the
verdi daemon clean-stale-pid-file
first, to make sureverdi daemon stop
will not block the starting of the container.EDIT: the argument
clean-stale-pid-file
seems nasty, maybe call itverdi daemon clean
?