Adding FINISHED and RELEASED to states to wait after in the _needs_reschedule method...
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 5 Nov 2013 10:53:01 +0000 (11:53 +0100)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 5 Nov 2013 10:53:01 +0000 (11:53 +0100)
examples/linux/ccn/ccncat_extended_ring_topo.py
src/nepi/execution/resource.py
src/nepi/resources/linux/rpmfuncs.py

index 7accb3a..06f5ac6 100755 (executable)
@@ -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]
index ed16e08..397dab4 100644 (file)
@@ -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
 
index 8bc7e14..35aeb61 100644 (file)
@@ -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 ; } && ..