service

service

Generic Node base class for all workers that run on hosts.

class oslo_service.service.Launcher(conf, restart_method='reload')

Bases: object

Launch one or more services and wait for them to complete.

launch_service(service, workers=1)

Load and start the given service.

Parameters
  • service – The service you would like to start, must be an instance of oslo_service.service.ServiceBase

  • workers – This param makes this method compatible with ProcessLauncher.launch_service. It must be None, 1 or omitted.

Returns

None

restart()

Reload config files and restart service.

Returns

The return value from reload_config_files or mutate_config_files, according to the restart_method.

stop()

Stop all services which are currently running.

Returns

None

wait()

Wait until all services have been stopped, and then return.

Returns

None

class oslo_service.service.ProcessLauncher(conf, wait_interval=0.01, restart_method='reload')

Bases: object

Launch a service with a given number of workers.

handle_signal()

Add instance’s signal handlers to class handlers.

launch_service(service, workers=1)

Launch a service with a given number of workers.

Parameters
stop()

Terminate child processes and wait on each.

wait()

Loop waiting on children to die and respawning as necessary.

class oslo_service.service.Service(threads=1000)

Bases: oslo_service.service.ServiceBase

Service object for binaries running on hosts.

reset()

Reset a service in case it received a SIGHUP.

start()

Start a service.

stop(graceful=False)

Stop a service.

Parameters

graceful – indicates whether to wait for all threads to finish or terminate them instantly

wait()

Wait for a service to shut down.

class oslo_service.service.ServiceBase

Bases: object

Base class for all services.

abstract reset()

Reset service.

Called in case service running in daemon mode receives SIGHUP.

abstract start()

Start service.

abstract stop()

Stop service.

abstract wait()

Wait for service to complete.

class oslo_service.service.ServiceLauncher(conf, restart_method='reload')

Bases: oslo_service.service.Launcher

Runs one or more service in a parent process.

handle_signal()

Set self._handle_signal as a signal handler.

wait()

Wait for a service to terminate and restart it on SIGHUP.

Returns

termination status

exception oslo_service.service.SignalExit(signo, exccode=1)

Bases: SystemExit

oslo_service.service.launch(conf, service, workers=1, restart_method='reload')

Launch a service with a given number of workers.

Parameters
  • conf – an instance of ConfigOpts

  • service – a service to launch, must be an instance of oslo_service.service.ServiceBase

  • workers – a number of processes in which a service will be running, type should be int.

  • restart_method – Passed to the constructed launcher. If ‘reload’, the launcher will call reload_config_files on SIGHUP. If ‘mutate’, it will call mutate_config_files on SIGHUP. Other values produce a ValueError.

Returns

instance of a launcher that was used to launch the service

oslo_service.service.list_opts()

Entry point for oslo-config-generator.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.