[openstack-dev] [oslo][oslo-service] Multi main processes are started by using oslo_service

zhi changzhi1990 at gmail.com
Tue Jun 27 09:56:04 UTC 2017


Hi, all.

    Here, I want to start a main process and multi subprocess by using
oslo_service. So I launch a service like this:

    from oslo_service import service as common_service

    def serve_wsgi(cls):
        try:
            service = cls.create()
        except Exception:
            with excutils.save_and_reraise_exception():
            LOG.exception(''......')

        return service

    class ApiService(WsgiService):
    """Class for tacker-api service."""

    @classmethod
    def create(cls, app_name='abc'):
        service = cls(app_name)
        return service

    api = service.serve_wsgi(service.ApiService)
    launcher = common_service.launch(cfg.CONF, api,
                                         workers=cfg.CONF.api_workers or
None)
    launcher.wait()

Everything goes well when the "api_workers " equals 0 or 1. But two main
processes were started when the " api_workers " equals 2. The log shows
below:

2017-06-27 17:42:18.864 1958058 INFO abc.common.wsgi [-] (1958058) wsgi
starting up on http://0.0.0.0:9914/

2017-06-27 17:42:18.864 1958059 INFO abc.common.wsgi [-] (1958059) wsgi
starting up on http://0.0.0.0:9914/


Could someone tell me the reason why two main processes were started ?


Thanks
Zhi Chang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170627/a11ff4fa/attachment.html>


More information about the OpenStack-dev mailing list