Adding state RELEASED in EC to allow two stage termination from the experiment runner
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Fri, 31 Oct 2014 08:42:43 +0000 (09:42 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Fri, 31 Oct 2014 08:42:43 +0000 (09:42 +0100)
src/nepi/execution/ec.py
src/nepi/execution/runner.py

index 2e573dd..58ece22 100644 (file)
@@ -90,7 +90,8 @@ class ECState(object):
     """
     RUNNING = 1
     FAILED = 2
-    TERMINATED = 3
+    RELEASED = 3
+    TERMINATED = 4
 
 class ExperimentController(object):
     """
@@ -1033,6 +1034,9 @@ class ExperimentController(object):
             :type guids: list
 
         """
+        if self._state == ECState.RELEASED:
+           return 
+
         if isinstance(guids, int):
             guids = [guids]
 
@@ -1050,7 +1054,10 @@ class ExperimentController(object):
 
         for guid in guids:
             if self.get(guid, "hardRelease"):
-                self.remove_resource(guid)
+                self.remove_resource(guid)\
+
+        # Mark the EC state as RELEASED
+        self._state = ECState.RELEASED
         
     def shutdown(self):
         """ Releases all resources and stops the ExperimentController
index 2a78be0..21a20cb 100644 (file)
@@ -116,6 +116,7 @@ class ExperimentRunner(object):
             if run >= min_runs and max_runs > -1 and run >= max_runs :
                 stop = True
 
+            ec.shutdown()
             del ec
 
         return run