Allow sporadic failures while polling application status
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 27 Sep 2011 01:57:07 +0000 (03:57 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 27 Sep 2011 01:57:07 +0000 (03:57 +0200)
src/nepi/testbeds/planetlab/application.py

index 650a03e..0a23807 100644 (file)
@@ -372,6 +372,7 @@ class Dependency(object):
         if pid and ppid:
             delay = 1.0
             first = True
+            bustspin = 0
             while True:
                 status = rspawn.remote_status(
                     pid, ppid,
@@ -383,9 +384,15 @@ class Dependency(object):
                     server_key = self.node.server_key
                     )
                 
-                if status is not rspawn.RUNNING:
+                if status is rspawn.FINISHED:
                     self._build_pid = self._build_ppid = None
                     break
+                elif status is not rspawn.RUNNING:
+                    bustspin += 1
+                    time.sleep(5)
+                    if bustspin > 12:
+                        self._build_pid = self._build_ppid = None
+                        break
                 else:
                     if first:
                         self._logger.info("Waiting for %s to finish building %s", self,