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


Python WorkerPdsh.node_buffer方法代码示例

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


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

示例1: testWorkerPdshGetCommand

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testWorkerPdshGetCommand(self):
     # test worker.command with WorkerPdsh
     worker1 = WorkerPdsh(HOSTNAME, command="/bin/echo foo bar fuu",
                          handler=None, timeout=5)
     self._task.schedule(worker1)
     worker2 = WorkerPdsh(HOSTNAME, command="/bin/echo blah blah foo",
                          handler=None, timeout=5)
     self._task.schedule(worker2)
     # run task
     self._task.resume()
     # test output
     self.assertEqual(worker1.node_buffer(HOSTNAME), b"foo bar fuu")
     self.assertEqual(worker1.command, "/bin/echo foo bar fuu")
     self.assertEqual(worker2.node_buffer(HOSTNAME), b"blah blah foo")
     self.assertEqual(worker2.command, "/bin/echo blah blah foo")
开发者ID:cea-hpc,项目名称:clustershell,代码行数:17,代码来源:TaskDistantPdshMixin.py

示例2: testWorkerPdshGetCommand

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
    def testWorkerPdshGetCommand(self):
        """test worker.command with WorkerPdsh"""

        worker1 = WorkerPdsh("localhost", command="/bin/echo foo bar fuu",
                             handler=None, timeout=5)
        self.assert_(worker1 != None)
        self._task.schedule(worker1)
        worker2 = WorkerPdsh("localhost", command="/bin/echo blah blah foo",
                             handler=None, timeout=5)
        self.assert_(worker2 != None)
        self._task.schedule(worker2)
        # run task
        self._task.resume()
        # test output
        self.assertEqual(worker1.node_buffer("localhost"), "foo bar fuu")
        self.assertEqual(worker1.command, "/bin/echo foo bar fuu")
        self.assertEqual(worker2.node_buffer("localhost"), "blah blah foo")
        self.assertEqual(worker2.command, "/bin/echo blah blah foo")
开发者ID:ChristianKniep,项目名称:clustershell,代码行数:20,代码来源:TaskDistantPdshTest.py

示例3: testEscapePdsh2

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testEscapePdsh2(self):
     """test distant worker (pdsh) cmd with non-escaped variable"""
     worker = WorkerPdsh("localhost", command="export CSTEST=foobar; /bin/echo $CSTEST | sed 's/\ foo/bar/'",
             handler=None, timeout=None)
     self._task.schedule(worker)
     # execute
     self._task.resume()
     # read result
     self.assertEqual(worker.node_buffer("localhost"), "foobar")
开发者ID:ChristianKniep,项目名称:clustershell,代码行数:11,代码来源:TaskDistantPdshTest.py

示例4: testEscapePdsh2

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testEscapePdsh2(self):
     # test distant worker (pdsh) cmd with non-escaped variable
     cmd = r"export CSTEST=foobar; /bin/echo $CSTEST | sed 's/\ foo/bar/'"
     worker = WorkerPdsh(HOSTNAME, command=cmd, handler=None, timeout=None)
     self._task.schedule(worker)
     # execute
     self._task.resume()
     # read result
     self.assertEqual(worker.node_buffer(HOSTNAME), b"foobar")
开发者ID:cea-hpc,项目名称:clustershell,代码行数:11,代码来源:TaskDistantPdshMixin.py

示例5: testExplicitPdshWorker

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testExplicitPdshWorker(self):
     # test simple localhost command with explicit pdsh worker
     # init worker
     worker = WorkerPdsh(HOSTNAME, command="echo alright", handler=None)
     self._task.schedule(worker)
     # run task
     self._task.resume()
     # test output
     self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
开发者ID:cea-hpc,项目名称:clustershell,代码行数:11,代码来源:TaskDistantPdshMixin.py

示例6: testExplicitPdshWorker

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testExplicitPdshWorker(self):
     """test simple localhost command with explicit pdsh worker"""
     # init worker
     worker = WorkerPdsh("localhost", command="echo alright", handler=None, timeout=5)
     self.assert_(worker != None)
     self._task.schedule(worker)
     # run task
     self._task.resume()
     # test output
     self.assertEqual(worker.node_buffer("localhost"), "alright")
开发者ID:ChristianKniep,项目名称:clustershell,代码行数:12,代码来源:TaskDistantPdshTest.py

示例7: testEscapePdsh

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testEscapePdsh(self):
     # test distant worker (pdsh) cmd with escaped variable
     worker = WorkerPdsh(HOSTNAME, command="export CSTEST=foobar; /bin/echo \$CSTEST | sed 's/\ foo/bar/'",
             handler=None, timeout=None)
     #task.set_info("debug", True)
     self._task.schedule(worker)
     # execute
     self._task.resume()
     # read result
     self.assertEqual(worker.node_buffer(HOSTNAME), "$CSTEST")
开发者ID:brianpkelly,项目名称:clustershell,代码行数:12,代码来源:TaskDistantPdshMixin.py

示例8: testShellPdshEventsNoReadNoTimeout

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testShellPdshEventsNoReadNoTimeout(self):
     # test triggered events (no read, no timeout) with explicit pdsh worker
     test_eh = self.__class__.TEventHandlerChecker(self)
     worker = WorkerPdsh(HOSTNAME, command="sleep 2", handler=test_eh,
                         timeout=None)
     self._task.schedule(worker)
     # run task
     self._task.resume()
     # test events received: start, close
     self.assertEqual(test_eh.flags, EV_START | EV_PICKUP | EV_HUP | EV_CLOSE)
     self.assertEqual(worker.node_buffer(HOSTNAME), None)
开发者ID:cea-hpc,项目名称:clustershell,代码行数:13,代码来源:TaskDistantPdshMixin.py

示例9: testExplicitWorkerPdshShellEventsWithTimeout

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testExplicitWorkerPdshShellEventsWithTimeout(self):
     # test triggered events (with timeout) with explicit pdsh worker
     test_eh = self.__class__.TEventHandlerChecker(self)
     worker = WorkerPdsh(HOSTNAME, command="echo alright && sleep 10",
                         handler=test_eh, timeout=2)
     self._task.schedule(worker)
     # run task
     self._task.resume()
     # test events received: start, read, timeout, close
     self.assertEqual(test_eh.flags, EV_START | EV_PICKUP | EV_READ | EV_TIMEOUT | EV_CLOSE)
     self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
开发者ID:cea-hpc,项目名称:clustershell,代码行数:13,代码来源:TaskDistantPdshMixin.py

示例10: testExplicitPdshWorkerWithOptions

# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
 def testExplicitPdshWorkerWithOptions(self):
     self._task.set_info("pdsh_path", "/usr/bin/pdsh -S")
     worker = WorkerPdsh(HOSTNAME, command="echo alright", handler=None)
     self._task.schedule(worker)
     # run task
     self._task.resume()
     # test output
     self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
     # clear options after test
     task_cleanup()
     self.assertEqual(task_self().info("pdsh_path"), None)
开发者ID:cea-hpc,项目名称:clustershell,代码行数:13,代码来源:TaskDistantPdshMixin.py


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