def __init__(self, config, service_id, worker_id, parent_pipe, started_hooks, graceful_shutdown_timeout):
    super(ServiceWorker, self).__init__()
    self._ready = threading.Event()
    _utils.spawn(self._watch_parent_process, parent_pipe)
    random.seed()
    args = (tuple() if (config.args is None) else config.args)
    kwargs = (dict() if (config.kwargs is None) else config.kwargs)
    self.service = config.service(worker_id, *args, **kwargs)
    self.service._initialize(worker_id)
    if (self.service.graceful_shutdown_timeout is None):
        self.service.graceful_shutdown_timeout = graceful_shutdown_timeout
    self.title = ('%(name)s(%(worker_id)d) [%(pid)d]' % dict(name=self.service.name, worker_id=worker_id, pid=os.getpid()))
    _utils.setproctitle(('%(pname)s: %(name)s worker(%(worker_id)d)' % dict(pname=_utils.get_process_name(), name=self.service.name, worker_id=worker_id)))
    self._ready.set()
    _utils.run_hooks('new_worker', started_hooks, service_id, worker_id, self.service)
def __init__(self, config, service_id, worker_id, parent_pipe, started_hooks, graceful_shutdown_timeout):
    super(ServiceWorker, self).__init__()
    self._ready = threading.Event()
    _utils.spawn(self._watch_parent_process, parent_pipe)
    random.seed()
    args = (tuple() if (config.args is None) else config.args)
    kwargs = (dict() if (config.kwargs is None) else config.kwargs)
    self.service = config.service(worker_id, *args, **kwargs)
    self.service._initialize(worker_id)
    if (self.service.graceful_shutdown_timeout is None):
        self.service.graceful_shutdown_timeout = graceful_shutdown_timeout
    self.title = ('%(name)s(%(worker_id)d) [%(pid)d]' % dict(name=self.service.name, worker_id=worker_id, pid=os.getpid()))
    _utils.setproctitle(('%(pname)s: %(name)s worker(%(worker_id)d)' % dict(pname=_utils.get_process_name(), name=self.service.name, worker_id=worker_id)))
    self._ready.set()
    _utils.run_hooks('new_worker', started_hooks, service_id, worker_id, self.service)