From: Alina Quereilhac Date: Tue, 5 Nov 2013 10:53:01 +0000 (+0100) Subject: Adding FINISHED and RELEASED to states to wait after in the _needs_reschedule method... X-Git-Tag: nepi-3.0.0~21 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=5afea61e207061be0647ac4ea98f8c9683b03f24;p=nepi.git Adding FINISHED and RELEASED to states to wait after in the _needs_reschedule method in the RM --- diff --git a/examples/linux/ccn/ccncat_extended_ring_topo.py b/examples/linux/ccn/ccncat_extended_ring_topo.py index 7accb3a5..06f5ac66 100755 --- a/examples/linux/ccn/ccncat_extended_ring_topo.py +++ b/examples/linux/ccn/ccncat_extended_ring_topo.py @@ -138,13 +138,21 @@ if __name__ == '__main__': ec = ExperimentController(exp_id = exp_id) - # host in the US - host1 = "planetlab4.wail.wisc.edu" - host2 = "planetlab2.cs.columbia.edu" - host3 = "ricepl-2.cs.rice.edu" - host4 = "node1.planetlab.albany.edu" - host5 = "earth.cs.brown.edu" - host6 = "planetlab2.engr.uconn.edu" + # hosts in the US + #host1 = "planetlab4.wail.wisc.edu" + #host2 = "planetlab2.cs.columbia.edu" + #host3 = "ricepl-2.cs.rice.edu" + #host4 = "node1.planetlab.albany.edu" + #host5 = "earth.cs.brown.edu" + #host6 = "planetlab2.engr.uconn.edu" + + # hosts in EU + host1 = "planetlab2.fct.ualg.pt" + host2 = "planet2.unipr.it" + host3 = "planetlab1.aston.ac.uk" + host4 = "itchy.comlab.bth.se" + host5 = "rochefort.infonet.fundp.ac.be" + host6 = "planetlab1.u-strasbg.fr" # describe nodes in the central ring ring_hosts = [host1, host2, host3, host4] 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 diff --git a/src/nepi/resources/linux/rpmfuncs.py b/src/nepi/resources/linux/rpmfuncs.py index 8bc7e142..35aeb612 100644 --- a/src/nepi/resources/linux/rpmfuncs.py +++ b/src/nepi/resources/linux/rpmfuncs.py @@ -31,7 +31,7 @@ def install_packages_command(os, packages): cmd = install_rpmfusion_command(os) if cmd: cmd += " ; " cmd += " && ".join(map(lambda p: - " { rpm -q %(package)s || sudo -S yum --nogpgcheck -y install %(package)s ; } " % { + " { rpm -q %(package)s || sudo -S yum -y install --nogpgcheck %(package)s ; } " % { 'package': p}, packages)) #cmd = { rpm -q rpmfusion-free-release || sudo -s rpm -i ... ; } && { rpm -q vim || sudo yum -y install vim ; } && ..