Base¶
Interface definition and base implementation for all subprocess managers.
Interface¶
-
class
servermgr.base.ManagerInterface[source]¶ This abstract class defines the interface implemented by all Managers.
-
health()[source]¶ Check the health of the worker subprocess.
Raises: WorkerError if the worker subprocess is not responding.
-
ready_wait(timeout=10.0)[source]¶ Wait for the worker to be ready to handle requests.
Parameters: timeout (float, seconds) – Give the server this many seconds to start. If the timeout expires before the server has started, kill the server and raise WorkerError. Raises: WorkerError if the worker is not ready within the time limit.
-
start(wait=True, timeout=10.0)[source]¶ Start the worker subprocess.
Parameters: - wait – If true, call self.ready_wait() after starting the subprocess.
- timeout (float, number of seconds) – When calling ready_wait(), use this timeout value.
-
Exceptions¶
Utility Functions¶
Classes¶
-
class
servermgr.base.Manager(name='<unnamed>', **kwargs)[source]¶ Parameters: - name – Name of manager, displayed in error and log messages.
- kwargs – Any other keyword args will be stored in self.kwargs.
This is the base implementation of the Manager class.
Implementations are provided for the following methods:
- ready_wait()
- stop()
- wait()
The following methods must be implemented by the subclass:
- health()
- start()
-
health()[source]¶ Check the worker subprocess health.
Raises: NotImplementedError must be implemented by subclass.
-
process¶ Return the process object.
-
ready_wait(timeout=10.0, verbose=False)[source]¶ Wait until the worker subprocess is responding to requests.
Parameters: timeout (float, seconds) – Give the server this many seconds to start. If the timeout expires before the server has started, kill the server and raise WorkerError. Raises: WorkerError if the worker is not ready within the time limit. Raises: WorkerError if there is no subprocess.
-
start(wait=True, timeout=10.0)[source]¶ Start the worker subprocess.
Raises: NotImplementedError must be implemented by subclass.