[cig-commits] r14312 - cs/portal/trunk/northridge/backend

leif at geodynamics.org leif at geodynamics.org
Thu Mar 12 18:33:19 PDT 2009


Author: leif
Date: 2009-03-12 18:33:18 -0700 (Thu, 12 Mar 2009)
New Revision: 14312

Modified:
   cs/portal/trunk/northridge/backend/daemon.py
   cs/portal/trunk/northridge/backend/mineos.cfg
   cs/portal/trunk/northridge/backend/mineos.py
Log:
Wrote progress bar code for new, parallel Mineos backend.


Modified: cs/portal/trunk/northridge/backend/daemon.py
===================================================================
--- cs/portal/trunk/northridge/backend/daemon.py	2009-03-13 00:47:38 UTC (rev 14311)
+++ cs/portal/trunk/northridge/backend/daemon.py	2009-03-13 01:33:18 UTC (rev 14312)
@@ -496,7 +496,6 @@
 
                 # send jobs to jobSink()
                 self.jobChannel.send(job)
-                self.jobChannel.send(None) # no more jobs
 
                 self.setStatus(self.STATUS_PREPARING)
 
@@ -513,6 +512,8 @@
         except Exception, e:
             self.info.log("error: %s: %s" % (e.__class__.__name__, e))
             self.setStatus(self.STATUS_ERROR)
+
+        self.jobChannel.send(None) # no more jobs
         
         return
 
@@ -634,7 +635,7 @@
                     if code == 1:
                         newRun = SpecfemRun(id, urlForInputFile, config, self.info, gjm)
                     elif code == 2:
-                        newRun = MineosRun(id, urlForInputFile, config, self.info, fjm)
+                        newRun = MineosRun(id, urlForInputFile, config, self.info, gjm)
                     else:
                         self.info.log("unknown code %d" % code)
                         continue

Modified: cs/portal/trunk/northridge/backend/mineos.cfg
===================================================================
--- cs/portal/trunk/northridge/backend/mineos.cfg	2009-03-13 00:47:38 UTC (rev 14311)
+++ cs/portal/trunk/northridge/backend/mineos.cfg	2009-03-13 01:33:18 UTC (rev 14312)
@@ -2,7 +2,7 @@
 [mineos]
 scheduler = lsf
 launch-command = pam -g 1 parametric_wrapper
-seismo-nodes = 100    ; use multiple of 4 on Lonestar
+seismo-nodes = 40    ; use multiple of 4 on Lonestar
 
 [mineos.journal.info]
 lsf = true

Modified: cs/portal/trunk/northridge/backend/mineos.py
===================================================================
--- cs/portal/trunk/northridge/backend/mineos.py	2009-03-13 00:47:38 UTC (rev 14311)
+++ cs/portal/trunk/northridge/backend/mineos.py	2009-03-13 01:33:18 UTC (rev 14312)
@@ -599,22 +599,64 @@
 
 
     def monitorProgress(self, pid):
+        context = self.context
+        if context == "loginEigen":
+            sleepTime = 600
+        elif context == "loginSeismograms":
+            sleepTime = 60
+            self.nStations = None
+        else:
+            sleepTime = 60
         progress = None
         wpid, status = os.waitpid(pid, os.WNOHANG)
         while wpid == 0:
             newProgress = self.checkProgress()
             if newProgress != progress:
                 progress = newProgress
-                #self.postProgress(progress)
-            sleep(60)
+                self.postProgress(progress)
+            sleep(sleepTime)
             wpid, status = os.waitpid(pid, os.WNOHANG)
         return
 
 
     def checkProgress(self):
-        # XXX
-        progress = 0.0
-        return progress
+        context = self.context
+        if context == "loginEigen":
+            # The 'spheroidal' mode is the only one that takes a
+            # significant amount of time to compute.
+            if not self.spheroidal:
+                return None
+            try:
+                s = open(join(archiveDirName, "spheroidal_listing"), 'r')
+            except IOError:
+                return None
+            normin = max(self.nmin, 0)
+            normax = max(self.nmax, normin)
+            nord = 0
+            for line in s:
+                pieces = line.split()
+                if len(pieces) < 2:
+                    continue
+                ichar = pieces[1]
+                if ichar != 's':
+                    continue
+                nord = int(pieces[0])
+            return float(nord - normin) / float(normax - normin)
+        elif context == "loginSeismograms":
+            # The duration of this computation can be tuned with the
+            # "seismo-nodes" setting.
+            try:
+                s = open(join(archiveDirName, self.indexedName("output_green_syndat", 0) + ".txt"), 'r')
+                if self.nStations is None:
+                    self.nStations = lineCount(join(archiveDirName, self.indexedStationsName(0) + ".site"))
+            except IOError:
+                return None
+            stationTally = 0
+            for line in s:
+                if line.startswith(" green: Station: "):
+                    stationTally += 1
+            return float(stationTally) / float(self.nStations)
+        return None
 
 
     def postProgress(self, progress):



More information about the CIG-COMMITS mailing list