[cig-commits] r8232 - cs/portal/trunk

leif at geodynamics.org leif at geodynamics.org
Wed Nov 7 14:00:34 PST 2007


Author: leif
Date: 2007-11-07 14:00:32 -0800 (Wed, 07 Nov 2007)
New Revision: 8232

Modified:
   cs/portal/trunk/daemon.py
Log:
Minor pre-workshop fixes that I neglected to check-in: reduce
'globus-job-status' polling activity by sleeping for increasing
amounts of time when nothing is changing; changed job status machinery
slightly to accomodate mesher/solver split (run status is reported by
job itself -- or hopefully will be someday soon).


Modified: cs/portal/trunk/daemon.py
===================================================================
--- cs/portal/trunk/daemon.py	2007-11-07 20:50:49 UTC (rev 8231)
+++ cs/portal/trunk/daemon.py	2007-11-07 22:00:32 UTC (rev 8232)
@@ -71,12 +71,16 @@
             id = self.globusrun(resSpec)
             
             oldStatus = job.status
+            ticks = 2
             while job.isAlive():
-                self.clock.tick.wait()
+                for t in xrange(ticks):
+                    self.clock.tick.wait()
+                ticks *= 2
                 status = self.getJobStatus(id)
                 if status != oldStatus:
                     job.setStatus(status)
                     oldStatus = status
+                    ticks = 2
         
         except Exception, e:
             self.info.log("error: %s: %s" % (e.__class__.__name__, e))
@@ -296,10 +300,12 @@
     
     # status codes
     STATUS_NEW        = "new"
-    STATUS_PREPARING  = "preparing"
-    STATUS_PENDING    = "pending"
-    STATUS_RUNNING    = "running"
-    #STATUS_FINISHING  = "finishing"
+    STATUS_CONNECTING = "connecting"
+    STATUS_PREPARING  = "preparing"  # reported by build & schedule process
+    STATUS_PENDING    = "pending"    # reported by build & schedule process
+    STATUS_MESHING    = "meshing"    # reported by launcher process
+    STATUS_SOLVING    = "solving"    # reported by launcher process
+    STATUS_FINISHING  = "finishing"  # reported by launcher process
     STATUS_DONE       = "done"
     STATUS_ERROR      = "error"
     deadCodes = [STATUS_DONE, STATUS_ERROR]
@@ -321,17 +327,18 @@
 
     def __call__(self, jm):
         try:
+            self.setStatus(self.STATUS_CONNECTING)
+            
             # run
             job = self.newJob()
             self.job = job
             jm.runJob(job)
+
+            # also reported by job; but we need it here to tickle job watcher
+            self.setStatus(self.STATUS_PREPARING)
             
-            self.setStatus(self.STATUS_PENDING)
             while job.isAlive():
                 job.statusChanged.wait()
-                if job.status == job.STATUS_ACTIVE:
-                    #self.setStatus(self.STATUS_PREPARING)
-                    self.setStatus(self.STATUS_RUNNING)
             # while
 
             if job.status == job.STATUS_FAILED:
@@ -365,6 +372,7 @@
                          '--solver.stations=' + self.simulation.stations,
                          "--scheduler.wait=True",
                          "--job.name=run%05d" % self.id,
+                         "--portal-run-id=%d" % self.id,
                          #"--job.walltime=2*hour",
                          "--output-dir=.", # Globus scratch dir
                          "--job.stdout=stdout.txt",



More information about the cig-commits mailing list