-
Notifications
You must be signed in to change notification settings - Fork 188
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
DaemonClient
: Fix and homogenize use of timeout
in client calls
#5960
DaemonClient
: Fix and homogenize use of timeout
in client calls
#5960
Conversation
80fdbc5
to
6e20c49
Compare
Blocked by #5961 . See #5822 (comment) for an explanation |
@sphuber thanks a lot! You figure out the logic of daemon timeout! I guess this will allow us to come back to the PR #5928
This is one thing still not very clear to me. It means we use the same timeout for P.S @superstar54 shows interest in the daemon part and wants to have a look, so I'll leave the doc part reviewing for him to have a close look. |
The
This depends, I think, on whether Ultimately, if users really don't like this, adding a |
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.
@sphuber thanks for the explanation, now everything is clear. The changes look all good.
The `DaemonClient` provides a number of methods that will attempt to communicate with the daemon process, e.g., `stop_daemon` and `get_status`. This is done through the `CircusClient`, as the main daemon process is the circus daemonizer, which takes a timeout as argument indicating the number of seconds after which the call should raise if the daemon did not respond in time. The default timeout is set in the constructor of the `DaemonClient` based on the `daemon.timeout` config option. It was incorrectly getting the global value instead of the profile specific one, which is corrected by using `config.get_option('daemon.timeout', scope=profile.name)` to fetch the conifg option. A `timeout` argument is added to all `DaemonClient` methods that call through to the `CircusClient` that can be used to override the default that is based on the `daemon.timeout` config option. A default is added for `wait` in the `restart_daemon` method, to homogenize its interface with `start_daemon` and `stop_daemon`. The manual timeout cycle in `stop_daemon` by calling `_await_condition` has been removed as this functionality is already performed by the circus client itself and so is superfluous. The only place it is still used is in `start_daemon` because there the circus client is not used, since the circus process is not actually running yet, and a "manual" health check needs to be performed after the daemon process is launched. The manual check is added to the `stop_daemon` fixture since the check in certain unit test scenarios could give a false positive without an additional manual grace period for `is_daemon_running` to start returning `False`. The default for the `daemon.timeout` configuration option is decreased to 2 seconds, as this should be sufficient for most conditions for the circus daemon process to respond. Note that this daemon process is only charged with monitoring the daemon workers and so won't be under heavy load that will prevent it from responding in time.
cd68572
to
907ef6a
Compare
Fixes #4016
The
DaemonClient
provides a number of methods that will attempt to communicate with the daemon process, e.g.,stop_daemon
andget_status
. This is done through theCircusClient
, as the main daemon process is the circus daemonizer, which takes a timeout as argument indicating the number of seconds after which the call should raise if the daemon did not respond in time.The default timeout is set in the constructor of the
DaemonClient
based on thedaemon.timeout
config option. It was incorrectly getting the global value instead of the profile specific one, which is corrected by usingconfig.get_option('daemon.timeout', scope=profile.name)
to fetch the conifg option.A
timeout
argument is added to allDaemonClient
methods that call through to theCircusClient
that can be used to override the default that is based on thedaemon.timeout
config option.A default is added for
wait
in therestart_daemon
method, to homogenize its interface withstart_daemon
andstop_daemon
. The manual timeout cycle instop_daemon
by calling_await_condition
has been removed as this functionality is already performed by the circus client itself and so is superfluous. The only place it is still used is instart_daemon
because there the circus client is not used, since the circus process is not actually running yet, and a "manual" health check needs to be performed after the daemon process is launched.The default for the
daemon.timeout
configuration option is decreased to 2 seconds, as this should be sufficient for most conditions for the circus daemon process to respond. Note that this daemon process is only charged with monitoring the daemon workers and so won't be under heavy load that will prevent it from responding in time. The timeout is set to 5 seconds for the CI workflow, however, since the runners are typically less performant machines where 2 seconds may be insufficient and we don't want the tests to fail just because the call to stop the daemon at the end of the suite timed out.