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


Python ScalarisVM.getNodes方法代码示例

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


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

示例1: testGetNodes_NotConnected

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def testGetNodes_NotConnected(self):
     """Test method for ScalarisVM.getNodes() with a closed connection."""
     vm = ScalarisVM()
     vm.close_connection()
     #self.assertRaises(scalaris.ConnectionError, vm.getNodes())
     vm.getNodes()
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:9,代码来源:scalaris_test.py

示例2: testGetNodes1

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def testGetNodes1(self):
     """Test method for ScalarisVM.getNodes()."""
     vm = ScalarisVM()
     nodes = vm.getNodes()
     self.assertTrue(isinstance(nodes, list), msg = nodes)
     self.assertTrue(len(nodes) >= 0)
     self.assertEqual(len(nodes), vm.getNumberOfNodes())
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:10,代码来源:scalaris_test.py

示例3: _testDeleteNodesByName

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def _testDeleteNodesByName(self, nodesToRemove, action):
     """Test method for ScalarisVM.shutdownNode() and ScalarisVM.killNode()."""
     vm = ScalarisVM()
     size = vm.getNumberOfNodes();
     if nodesToRemove >= 1:
         vm.addNodes(nodesToRemove)
         self.assertEqual(size + nodesToRemove, vm.getNumberOfNodes())
     nodes = vm.getNodes()
     shuffle(nodes)
     removedNodes = nodes[:nodesToRemove]
     if action == 'shutdown':
         (ok, not_found) = vm.shutdownNodesByName(removedNodes)
     elif action == 'kill':
         (ok, not_found) = vm.killNodesByName(removedNodes)
     self.assertEqual(nodesToRemove, len(ok))
     self.assertEqual(nodesToRemove, len(not_found))
     list.sort(removedNodes)
     list.sort(ok)
     self.assertEqual(removedNodes, ok)
     self.assertEqual(size, vm.getNumberOfNodes())
     nodes = vm.getNodes()
     for name in ok:
         self.assertTrue(not name in nodes, str(nodes) + " should not contain " + name)
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:26,代码来源:scalaris_test.py

示例4: _testDeleteNode

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def _testDeleteNode(self, action):
     """Test method for ScalarisVM.shutdownNode() and ScalarisVM.killNode()."""
     vm = ScalarisVM()
     size = vm.getNumberOfNodes();
     (ok, _failed) = vm.addNodes(1)
     name = ok[0]
     self.assertEqual(size + 1, vm.getNumberOfNodes())
     if action == 'shutdown':
         result = vm.shutdownNode(name)
     elif action == 'kill':
         result = vm.killNode(name)
     self.assertTrue(result)
     self.assertEqual(size, vm.getNumberOfNodes())
     nodes = vm.getNodes()
     self.assertTrue(not name in nodes, str(nodes) + " should not contain " + name)
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:18,代码来源:scalaris_test.py

示例5: _testDeleteNodes

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def _testDeleteNodes(self, nodesToRemove, action):
     """Test method for ScalarisVM.shutdownNode() and ScalarisVM.killNode()."""
     vm = ScalarisVM()
     size = vm.getNumberOfNodes();
     if nodesToRemove >= 1:
         vm.addNodes(nodesToRemove)
         self.assertEqual(size + nodesToRemove, vm.getNumberOfNodes())
     if action == 'shutdown':
         result = vm.shutdownNodes(nodesToRemove)
     elif action == 'kill':
         result = vm.killNodes(nodesToRemove)
     self.assertEqual(nodesToRemove, len(result))
     self.assertEqual(size, vm.getNumberOfNodes())
     nodes = vm.getNodes()
     for name in result:
         self.assertTrue(not name in nodes, str(nodes) + " should not contain " + name)
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:19,代码来源:scalaris_test.py

示例6: _testAddNodes

# 需要导入模块: from scalaris import ScalarisVM [as 别名]
# 或者: from scalaris.ScalarisVM import getNodes [as 别名]
 def _testAddNodes(self, nodesToAdd):
     """Test method for ScalarisVM.addNodes(nodesToAdd)."""
     vm = ScalarisVM()
     size = vm.getNumberOfNodes();
     (ok, failed) = vm.addNodes(nodesToAdd)
     size = size + nodesToAdd
     self.assertEqual(nodesToAdd, len(ok))
     self.assertEqual(len(failed), 0)
     self.assertEqual(size, vm.getNumberOfNodes())
     nodes = vm.getNodes()
     for name in ok:
         self.assertTrue(name in nodes, str(nodes) + " should contain " + name)
     for name in ok:
         vm.killNode(name)
     size = size - nodesToAdd
     self.assertEqual(size, vm.getNumberOfNodes())
     vm.close_connection()
开发者ID:gongyouliu,项目名称:scalaris,代码行数:19,代码来源:scalaris_test.py


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