X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Fexecution%2Fresource.py;h=397dab46bbfcbc6ef741502fb666702b7f660883;hb=5afea61e207061be0647ac4ea98f8c9683b03f24;hp=ed16e08870c38d2822d0b1d1c2bbc76f272f9f42;hpb=5f52b47aee711cb3b6581829c337666cbd8df65f;p=nepi.git diff --git a/src/nepi/execution/resource.py b/src/nepi/execution/resource.py index ed16e088..397dab46 100644 --- a/src/nepi/execution/resource.py +++ b/src/nepi/execution/resource.py @@ -698,6 +698,7 @@ class ResourceManager(Logger): connected.append(rm) return connected + @failtrap def _needs_reschedule(self, group, state, time): """ Internal method that verify if 'time' has elapsed since all elements in 'group' have reached state 'state'. @@ -720,6 +721,13 @@ class ResourceManager(Logger): # check state and time elapsed on all RMs for guid in group: rm = self.ec.get_resource(guid) + + # If one of the RMs this resource needs to wait for has FAILED + # we raise an exception + if rm.state == ResourceState.FAILED: + msg = "Resource can not wait for FAILED RM %d. Setting Resource to FAILED" + raise RuntimeError, msg + # If the RM state is lower than the requested state we must # reschedule (e.g. if RM is READY but we required STARTED). if rm.state < state: @@ -739,6 +747,10 @@ class ResourceManager(Logger): t = rm.start_time elif state == ResourceState.STOPPED: t = rm.stop_time + elif state == ResourceState.FINISHED: + t = rm.finish_time + elif state == ResourceState.RELEASED: + t = rm.release_time else: break