Adding state RELEASED in EC to allow two stage termination from the experiment runner
[nepi.git] / src / nepi / execution / ec.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