Services Library

class dploylib.services.Service(templates=None, config_mapper=None, coordinator=None)

The Service object provides a way to create a zeromq-based dploy service. In dploy, a the service object is in charge of a combination of Server objects. Each of the Server objects acts as a definition for a server which is used to spawn threads, processes, or greenlets of each server.

Parameters:
  • templates – a list of service templates to apply to this service
  • config_mapper – default YAMLConfigMapper, configuration mapper for the service
  • coordinator – the server coordinator for the service. Defaults to ThreadedServerCoordinator
add_server(name, server_cls)

Register a Server to the Service instance

Parameters:
  • name – name of the server
  • server_cls – A Server
run(*args, **kwargs)

A default method for running a service

start(config_file=None, config_string=None, config_dict=None)

Starts the service with the given configuration information. Configuration data is accepted from one of three different types: a file path, a string, or a dictionary.

Parameters:
  • config_file – file path for the configuration
  • config_string – a string of the configuration
  • config_dict – a dictionary for the configuration
stop()

Stop the service

wait()

Wait for the service forever or until it fails