-
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
👌 IMPROVE: Check for recycled circus PID #4858
👌 IMPROVE: Check for recycled circus PID #4858
Conversation
b45c11a
to
b0bec30
Compare
Hey @dev-zero , thanks for the contribution! It seems quite straightforward code-wise, but could you explain a bit the exact objective of this and what kind of problem is addressing in general (maybe you already did this in some issue, in which case, could you link it?) I guess most of the functionality can be deduced from the change itself but just to be sure intent aligns with execution. 😅 |
@ramirezfranciscof in that part of the code we are looking up whether there's a process for the recorded PID. If there is not we can assume the daemon crashed and we have to restart. If there is we have to be a bit more careful since the PID can be recycled (maybe after a restart of the machine, but also on long-running machines). If a process is found we have to see whether the process is in fact a circus process, and if it is a circus process whether it is started by the same user requesting the start. The last one is a real corner case because it would mean that another user on the same machine is running an aiida daemon and by chance got the same PID as this users aiida daemon before. |
b0bec30
to
505e32f
Compare
Codecov Report
@@ Coverage Diff @@
## develop #4858 +/- ##
===========================================
- Coverage 80.23% 79.66% -0.56%
===========================================
Files 515 523 +8
Lines 36746 37170 +424
===========================================
+ Hits 29478 29608 +130
- Misses 7268 7562 +294
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
@dev-zero thanks, it looks good to me.
I have another thought about this delete_stale_pid_file
check. Since it always sticks right after the client creation (except in cmd_daemon::stop show following, but I guess it's fine to move the line backwards), maybe it is safe to put this check inside get_daemon_client
? (discussion required, not required for this PR though)
:
aiida-core/aiida/cmdline/commands/cmd_daemon.py
Lines 191 to 195 in 53c5564
if not client.is_daemon_running: | |
echo.echo('Daemon was not running') | |
continue | |
delete_stale_pid_file(client) |
the pid of the stale process could be recycled as the daemon of someone else
9fb013d
to
057c8a5
Compare
@chrisjsewell can this be merged despite the coverage fail? |
No description provided.