[cig-commits] r13216 - short/3D/PyLith/trunk/pylith

brad at geodynamics.org brad at geodynamics.org
Sat Nov 1 16:15:42 PDT 2008


Author: brad
Date: 2008-11-01 16:15:42 -0700 (Sat, 01 Nov 2008)
New Revision: 13216

Modified:
   short/3D/PyLith/trunk/pylith/PyLithApp.py
Log:
Added logging of stages.

Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py	2008-11-01 23:15:07 UTC (rev 13215)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py	2008-11-01 23:15:42 UTC (rev 13216)
@@ -67,6 +67,7 @@
     Constructor.
     """
     Application.__init__(self, name)
+    self._loggingPrefix = "PyLith "
     return
 
 
@@ -80,17 +81,19 @@
     self._debug.log(resourceUsageString())
 
     self._setupLogging()
-    logEvent = "PyLith main"
-    self._logger.eventBegin(logEvent)
+    self._logger.eventBegin("PyLith main")
 
     # Create mesh (adjust to account for interfaces (faults) if necessary)
+    self._logger.stagePush("Meshing")
     interfaces = None
     if "interfaces" in dir(self.problem):
       interfaces = self.problem.interfaces.components()
     mesh = self.mesher.create(interfaces)
     self._debug.log(resourceUsageString())
+    self._logger.stagePop()
 
     # Setup problem, verify configuration, and then initialize
+    self._logger.stagePush("Setup")
     self.problem.preinitialize(mesh)
     self._debug.log(resourceUsageString())
 
@@ -99,14 +102,20 @@
     self.problem.initialize()
     self._debug.log(resourceUsageString())
 
+    self._logger.stagePop()
+
     # Run problem
+    self._logger.stagePush("Run")
     self.problem.run(self)
     self._debug.log(resourceUsageString())
+    self._logger.stagePop()
 
     # Cleanup
+    self._logger.stagePush("Finalize")
     self.problem.finalize()
+    self._logger.stagePop()
     
-    self._logger.eventEnd(logEvent)
+    self._logger.eventEnd("PyLith main")
     self.petsc.finalize()
     return
   
@@ -136,6 +145,13 @@
     logger.initialize()
     logger.registerEvent("PyLith main")
 
+    stages = ["Meshing",
+              "Setup",
+              "Run",
+              "Finalize"]
+    for stage in stages:
+      logger.registerStage(stage)
+
     self._logger = logger
     return
   



More information about the CIG-COMMITS mailing list