Service base class for creating standalone or composable services
A service is a container for two things: other services and greenlets. It then provides a common interface for starting and stopping them, based on a subset of the gevent.baseserver interface. This way you can include StreamServer or WSGIServer as child services.
Service also lets you catch exceptions in the greenlets started from this service and introduces the concept of ready, letting us block start() until the service is actually ready.
This property returns whether this service has been started
Add a child service to this service
The service added will be started when this service starts, before its _start() method is called. It will also be stopped when this service stops, before its _stop() method is called.
Empty implementation of service start. Implement me!
Return service.READY or starting will block until _ready() is called (or ready_timeout is reached).
Public interface for starting this service and children. By default it blocks until ready.
Stop this service and child services
If the server uses a pool to spawn the requests, then stop() also waits for all the handlers to exit. If there are still handlers executing after timeout has expired (default 1 second), then the currently running handlers in the pool are killed.
Start the service if it hasn’t been already started and wait until it’s stopped.