當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。