当前位置: 首页>>代码示例>>Python>>正文


Python DistantWorker._set_task方法代码示例

本文整理汇总了Python中ClusterShell.Worker.Worker.DistantWorker._set_task方法的典型用法代码示例。如果您正苦于以下问题:Python DistantWorker._set_task方法的具体用法?Python DistantWorker._set_task怎么用?Python DistantWorker._set_task使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClusterShell.Worker.Worker.DistantWorker的用法示例。


在下文中一共展示了DistantWorker._set_task方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _set_task

# 需要导入模块: from ClusterShell.Worker.Worker import DistantWorker [as 别名]
# 或者: from ClusterShell.Worker.Worker.DistantWorker import _set_task [as 别名]
    def _set_task(self, task):
        """
        Bind worker to task. Called by task.schedule().
        WorkerTree metaworker: override to schedule sub-workers.
        """
        ##if fanout is None:
        ##    fanout = self.router.fanout
        ##self.task.set_info('fanout', fanout)

        DistantWorker._set_task(self, task)
        # Now bound to task - initalize router
        self.topology = self.topology or task.topology
        self.router = self.router or task._default_router()
        # And launch stuffs
        next_hops = self._distribute(self.task.info("fanout"), self.nodes)
        for gw, targets in next_hops.iteritems():
            if gw == targets:
                self.logger.debug('task.shell cmd=%s nodes=%s timeout=%d' % \
                    (self.command, self.nodes, self.timeout))
                self._child_count += 1
                self._target_count += len(targets)
                self.workers.append(self.task.shell(self.command,
                    nodes=targets, timeout=self.timeout,
                    handler=self.metahandler, stderr=self.stderr, tree=False))
            else:
                self._execute_remote(self.command, targets, gw, self.timeout)
开发者ID:ChristianKniep,项目名称:clustershell,代码行数:28,代码来源:Tree.py

示例2: _set_task

# 需要导入模块: from ClusterShell.Worker.Worker import DistantWorker [as 别名]
# 或者: from ClusterShell.Worker.Worker.DistantWorker import _set_task [as 别名]
    def _set_task(self, task):
        """
        Bind worker to task. Called by task.schedule().
        WorkerTree metaworker: override to schedule sub-workers.
        """
        ##if fanout is None:
        ##    fanout = self.router.fanout
        ##self.task.set_info('fanout', fanout)

        DistantWorker._set_task(self, task)
        # Now bound to task - initalize router
        self.topology = self.topology or task.topology
        self.router = self.router or task._default_router()
        self._launch(self.nodes)
        self._check_ini()
开发者ID:thiell,项目名称:clustershell,代码行数:17,代码来源:Tree.py


注:本文中的ClusterShell.Worker.Worker.DistantWorker._set_task方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。