def initializer(self):
"""If set, the initializer function will be called after the subprocess
is started with the worker object as the first argument.
You can use this to, for example, set the process name suffix, to
distinguish between activity and workflow workers (when starting them
from the same process):
.. code-block:: python
from setproctitle import getproctitle, setproctitle
def set_worker_title(worker):
name = getproctitle()
if isinstance(worker, WorkflowWorker):
setproctitle(name + ' (WorkflowWorker)')
elif isinstance(worker, ActivityWorker):
setproctitle(name + ' (ActivityWorker)')
worker.initializer = set_worker_title
"""
try:
return self.__initializer
except AttributeError:
return lambda obj: None
评论列表
文章目录