A little more on ExperimentSuite
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 11 Sep 2011 12:33:31 +0000 (14:33 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Sun, 11 Sep 2011 12:33:31 +0000 (14:33 +0200)
src/nepi/core/execute.py
src/nepi/util/proxy.py
test/core/integration.py

index b9b0773..e08e20f 100644 (file)
@@ -1116,20 +1116,16 @@ class ExperimentSuite(object):
         self._status = TS.STATUS_ZERO
         self._thread = None
 
-    @property
     def current(self):
         return self._current
 
-    @property
     def status(self):
         return self._status
 
-    @property
     def is_finished(self):
         return self._status == TS.STATUS_STOPPED
 
-    @property
-    def access_configurations(self):
+    def get_access_configurations(self):
         return self._access_configs.values()
 
     def start(self):
@@ -1179,5 +1175,4 @@ class ExperimentSuite(object):
             while (time.time() - started_at) < self._duration:
                 time.sleep(0.5)
         controller.stop()
-        time.sleep(2)
 
index ac2f686..282fd92 100644 (file)
@@ -592,7 +592,7 @@ class ExperimentSuiteServer(BaseServer):
         self._repetitions = repetitions
         self._wait_guids = wait_guids
         self._access_config = access_config
-        self._experitment_suite = None
+        self._experiment_suite = None
 
     def post_daemonize(self):
         from nepi.core.execute import ExperimentSuite
@@ -604,25 +604,25 @@ class ExperimentSuiteServer(BaseServer):
     @Marshalling.args()
     @Marshalling.retval(int)
     def current(self):
-        return str(self._experiment_suite.current)
+        return self._experiment_suite.current()
    
     @Marshalling.handles(STATUS)
     @Marshalling.args()
     @Marshalling.retval(int)
     def status(self):
-        return self._experiment_suite.status
+        return self._experiment_suite.status()
     
     @Marshalling.handles(FINISHED)
     @Marshalling.args()
-    @Marshalling.retval(bool)
+    @Marshalling.retval(Marshalling.bool)
     def is_finished(self):
-        return self._experiment_suite.is_finished
+        return self._experiment_suite.is_finished()
 
     @Marshalling.handles(ACCESS_CONFIGURATIONS)
     @Marshalling.args()
     @Marshalling.retval( Marshalling.pickled_data )
-    def access_configurations(self):
-        return self._experiment_suite.access_configurations
+    def get_access_configurations(self):
+        return self._experiment_suite.get_access_configurations()
 
     @Marshalling.handles(START)
     @Marshalling.args()
index 55a0975..d627a4e 100755 (executable)
@@ -69,7 +69,7 @@ class ExecuteTestCase(unittest.TestCase):
 
         return exp_desc, desc1, desc2, iface12, iface21
 
-    def ptest_single_process_cross_integration(self):
+    def test_single_process_cross_integration(self):
         exp_desc, desc1, desc2, iface12, iface21 = \
                 self.make_cross_test_experiment()
         xml = exp_desc.to_xml()
@@ -83,7 +83,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_single_process_integration(self):
+    def test_single_process_integration(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         xml = exp_desc.to_xml()
         access_config = None
@@ -111,7 +111,7 @@ class ExecuteTestCase(unittest.TestCase):
         self.assertTrue(stopped_time < time.time())
         controller.shutdown()
 
-    def ptest_daemonized_controller_integration(self):
+    def test_daemonized_controller_integration(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         xml = exp_desc.to_xml()
         access_config = proxy.AccessConfiguration()
@@ -147,7 +147,7 @@ class ExecuteTestCase(unittest.TestCase):
         self.assertTrue(stopped_time < time.time())
         controller.shutdown()
 
-    def ptest_daemonized_testbed_integration(self):
+    def test_daemonized_testbed_integration(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         
         desc.set_attribute_value(DC.DEPLOYMENT_MODE, DC.MODE_DAEMON)
@@ -180,7 +180,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_daemonized_all_integration(self):
+    def test_daemonized_all_integration(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         
         desc.set_attribute_value(DC.DEPLOYMENT_MODE, DC.MODE_DAEMON)
@@ -232,7 +232,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_daemonized_all_integration_recovery(self):
+    def test_daemonized_all_integration_recovery(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         
         desc.set_attribute_value(DC.DEPLOYMENT_MODE, DC.MODE_DAEMON)
@@ -282,7 +282,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_reference_expressions(self):
+    def test_reference_expressions(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         
         iface1.set_attribute_value("label", "some")
@@ -312,7 +312,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_testbed_reference_expressions(self):
+    def test_testbed_reference_expressions(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         
         iface1.set_attribute_value("label", "some")
@@ -347,7 +347,7 @@ class ExecuteTestCase(unittest.TestCase):
         controller.stop()
         controller.shutdown()
 
-    def ptest_ssh_daemonized_integration(self):
+    def test_ssh_daemonized_integration(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
         env = test_util.test_environment()
         
@@ -385,20 +385,13 @@ class ExecuteTestCase(unittest.TestCase):
             controller.stop()
             controller.shutdown()
 
-    def test_experiment_suite(self):
+    def ptest_experiment_suite(self):
         exp_desc, desc, app, node1, node2, iface1, iface2 = self.make_test_experiment()
-        
-        desc.set_attribute_value(DC.DEPLOYMENT_MODE, DC.MODE_DAEMON)
-        desc.set_attribute_value(DC.ROOT_DIRECTORY, self.root_dir)
-        desc.set_attribute_value(DC.DEPLOYMENT_ENVIRONMENT_SETUP, 
-            "export PYTHONP TH=%r:%r:$PYTHONPATH "
-            "export NEPI_TESTBEDS='mock:mock mock2:mock2' " % (
-                os.path.dirname(os.path.dirname(mock.__file__)),
-                os.path.dirname(os.path.dirname(mock2.__file__)),))
-
+       
         xml = exp_desc.to_xml()
 
         access_config = proxy.AccessConfiguration()
+        access_config.set_attribute_value(DC.LOG_LEVEL, DC.DEBUG_LEVEL)
         access_config.set_attribute_value(DC.DEPLOYMENT_MODE, DC.MODE_DAEMON)
         access_config.set_attribute_value(DC.ROOT_DIRECTORY, self.root_dir)
         access_config.set_attribute_value(DC.DEPLOYMENT_ENVIRONMENT_SETUP, 
@@ -406,13 +399,14 @@ class ExecuteTestCase(unittest.TestCase):
             "export NEPI_TESTBEDS='mock:mock mock2:mock2' " % (
                 os.path.dirname(os.path.dirname(mock.__file__)),
                 os.path.dirname(os.path.dirname(mock2.__file__)),))
-       
+      
+        print self.root_dir
         exp_suite = proxy.create_experiment_suite(xml, access_config, repetitions = 4)
         exp_suite.start()
-        while not exp_suite.is_finished:
+        while not exp_suite.is_finished():
             time.sleep(0.5)
 
-        for access_config in exp_suite.access_configurations:
+        for access_config in exp_suite.get_access_configurations():
             access_config.set_attribute_value(DC.RECOVER, True)
             controller = proxy.create_experiment_controller(None, access_config)