multiprocessing_executor.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:botoflow 作者: boto 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号