當前位置: 首頁>>代碼示例>>Python>>正文


Python scalaris.ScalarisVM類代碼示例

本文整理匯總了Python中scalaris.ScalarisVM的典型用法代碼示例。如果您正苦於以下問題:Python ScalarisVM類的具體用法?Python ScalarisVM怎麽用?Python ScalarisVM使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ScalarisVM類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testGetNumberOfNodes1

 def testGetNumberOfNodes1(self):
     """Test method for ScalarisVM.getVersion()."""
     vm = ScalarisVM()
     number = vm.getNumberOfNodes()
     self.assertTrue(isinstance(number, int), msg = number)
     self.assertTrue(number >= 0)
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例2: testGetVersion1

 def testGetVersion1(self):
     """Test method for ScalarisVM.getVersion()."""
     vm = ScalarisVM()
     version = vm.getVersion()
     self.assertTrue(isinstance(version, basestring), msg = version)
     self.assertTrue(len(version) > 0)
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例3: testGetNodes1

 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,代碼行數:8,代碼來源:scalaris_test.py

示例4: _testGetOtherVMs

 def _testGetOtherVMs(self, maxVMs):
     """Test method for ScalarisVM.getOtherVMs()."""
     vm = ScalarisVM()
     otherVMs = vm.getOtherVMs(maxVMs)
     self.assertTrue(len(otherVMs) <= maxVMs, "list too long: " + str(otherVMs))
     for otherVMUrl in otherVMs:
         otherVM = ScalarisVM(JSONConnection(otherVMUrl))
         otherVM.getInfo()
         otherVM.close_connection()
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:10,代碼來源:scalaris_test.py

示例5: _testDeleteNode

 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,代碼行數:16,代碼來源:scalaris_test.py

示例6: _testAddNodes

 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,代碼行數:17,代碼來源:scalaris_test.py

示例7: _testKillVM_NotConnected

 def _testKillVM_NotConnected(self):
     """Test method for ScalarisVM.killVM() with a closed connection."""
     vm = ScalarisVM()
     vm.close_connection()
     #self.assertRaises(scalaris.ConnectionError, vm.killVM())
     vm.killVM()
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例8: testShutdownNodes_NotConnected

 def testShutdownNodes_NotConnected(self):
     """Test method for ScalarisVM.shutdownNodes() with a closed connection."""
     vm = ScalarisVM()
     vm.close_connection()
     #self.assertRaises(scalaris.ConnectionError, vm.shutdownNodes(0))
     vm.shutdownNodes(0)
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例9: testGetNumberOfNodes_NotConnected

 def testGetNumberOfNodes_NotConnected(self):
     """Test method for ScalarisVM.getNumberOfNodes() with a closed connection."""
     vm = ScalarisVM()
     vm.close_connection()
     #self.assertRaises(scalaris.ConnectionError, vm.getNumberOfNodes())
     vm.getNumberOfNodes()
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例10: testKillNodesByName_NotConnected

 def testKillNodesByName_NotConnected(self):
     """Test method for ScalarisVM.killNodesByName() with a closed connection."""
     vm = ScalarisVM()
     vm.close_connection()
     #self.assertRaises(scalaris.ConnectionError, vm.killNodesByName(["test"]))
     vm.killNodesByName(["test"])
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:7,代碼來源:scalaris_test.py

示例11: testGetInfo1

 def testGetInfo1(self):
     """Test method for ScalarisVM.getInfo()."""
     vm = ScalarisVM()
     info = vm.getInfo()
     self.assertTrue(isinstance(info.scalarisVersion, basestring), msg = info.scalarisVersion)
     self.assertTrue(len(info.scalarisVersion) > 0, msg = "scalaris_version (" + info.scalarisVersion + ") != \"\"");
     self.assertTrue(isinstance(info.erlangVersion, basestring), msg = info.erlangVersion)
     self.assertTrue(len(info.erlangVersion) > 0, msg = "erlang_version (" + info.erlangVersion + ") != \"\"");
     self.assertTrue(isinstance(info.memTotal, int), msg = info.memTotal)
     self.assertTrue(info.memTotal >= 0, msg = "mem_total (" + str(info.memTotal) + ") >= 0");
     self.assertTrue(isinstance(info.uptime, int), msg = info.uptime)
     self.assertTrue(info.uptime >= 0, msg = "uptime (" + str(info.uptime) + ") >= 0");
     self.assertTrue(isinstance(info.erlangNode, basestring), msg = info.erlangNode)
     self.assertTrue(len(info.erlangNode) > 0, msg = "erlang_node (" + info.erlangNode + ") != \"\"");
     self.assertTrue(isinstance(info.port, int), msg = info.port)
     self.assertTrue(info.port >= 0 and info.port <= 65535, msg = "0 <= port (" + str(info.port) + ") <= 65535");
     self.assertTrue(isinstance(info.yawsPort, int), msg = info.yawsPort)
     self.assertTrue(info.yawsPort >= 0 and info.yawsPort <= 65535, msg = "0 <= yaws_port (" + str(info.yawsPort) + ") <= 65535");
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:19,代碼來源:scalaris_test.py

示例12: _testDeleteNodes

 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,代碼行數:17,代碼來源:scalaris_test.py

示例13: _testDeleteNodesByName

 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,代碼行數:24,代碼來源:scalaris_test.py

示例14: _testShutdownVM1

 def _testShutdownVM1(self):
     """Test method for ScalarisVM.shutdownVM()."""
     vm = ScalarisVM()
     vm.shutdownVM()
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:5,代碼來源:scalaris_test.py

示例15: _testKillVM1

 def _testKillVM1(self):
     """Test method for ScalarisVM.killVM()."""
     vm = ScalarisVM()
     vm.killVM()
     vm.close_connection()
開發者ID:gongyouliu,項目名稱:scalaris,代碼行數:5,代碼來源:scalaris_test.py


注:本文中的scalaris.ScalarisVM類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。