Closed dev-zero closed 7 months ago
This is indeed unexpected - @sphuber do you agree?
@dev-zero what happens when you stop and start again?
it comes up with the correct number of workers
This is indeed unexpected - @sphuber do you agree?
Not necessarily. verdi daemon restart
is a soft restart and only restarts the workers, not the circus daemonizer. That means all settings remain unchanged. For that you need a full restart through verdi daemon restart --reset
which is equivalent to verdi daemon stop && verdi daemon start
.
If this is unclear, what we could do is making verdi daemon restart
do the full reset and then replace --reset
flag with something else (say --workers
or --soft
) and have that just restart the workers. Reason I did it the current way is that often one wants to just restart the workers and that is a lot faster than fully restarting the entire daemon
from Linux world (systemd and what not) I am used to restart
being equivalent to a stop
and start
The time difference is indeed significant, so I understand @sphuber 's original rationale.
$ time (verdi daemon stop && verdi daemon start)
Profile: nanoporous_pipeline
Waiting for the daemon to shut down... OK
Starting the daemon... RUNNING
real 0m5.027s
user 0m3.386s
sys 0m2.615s
$ time (verdi daemon restart)
Restarting the daemon... OK
real 0m1.572s
user 0m1.224s
sys 0m0.838s
At the same time, in typical operation restarting the daemon is a rare event, i.e. 4 seconds more or less does not make a world of difference and I would prefer simplicity of use over "performance" in this case (as the default behavior).
I can certainly see users be confused by restart
not being equivalent to stop
+ start
(and e.g. I implicitly assumed it myself in the proposed text for https://github.com/aiidateam/aiida-core/pull/4902/files).
If this is unclear, what we could do is making
verdi daemon restart
do the full reset and then replace--reset
flag with something else (say--workers
or--soft
) and have that just restart the workers.
I would vote for this solution (--soft
).
Since we often anyway recommend verdi daemon restart --reset
, shall we implement this change (and go with a full restart by default, and --soft
as an option)? @sphuber @khsrali @GeigerJ2 - if we agree, it's an easy change
Yeah, I think that would make sense. We can simply deprecate --reset
and say that is now the default. I am not even sure that we would need the other option for now. If they want to restart the workers, they can just restart the entire daemon. The only downside is that it takes a bit longer, but I don't think that will ever be a problem, especially since it won't be clear to the user anyway when they can do with just resetting the workers and not the entire daemon.
@khsrali @GeigerJ2 either of you want to pick this one up?
yes, I agree it makes sense. It should be an easy change. I'll do it, it's a good exercise.
The time difference is indeed significant, so I understand @sphuber 's original rationale.
FWIW I re-did a quick n dirty timing on my machine on current main, and the soft reset now takes about 1s, while the hard reset about 1.8s so the difference seems to be much less significant. :+1:
Describe the bug
Expected behavior
After the restart the new number of workers should be used
Your environment