ajack 2004/02/23 13:55:36
Modified: python/gump engine.py integrate.py
python/gump/utils __init__.py
python/gump/output nag.py
python/gump/document forrest.py
Log:
First stab at logging resource usage at stages throughout run.
Revision Changes Path
1.59 +26 -4 jakarta-gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- engine.py 15 Feb 2004 17:32:05 -0000 1.58
+++ engine.py 23 Feb 2004 21:55:35 -0000 1.59
@@ -12,7 +12,7 @@
from gump.gumprun import *
from gump.config import dir, default, basicConfig
-from gump.utils import dump, display, getIndent
+from gump.utils import dump, display, getIndent, logResourceUtilization
from gump.utils.note import Annotatable
from gump.utils.work import *
@@ -49,17 +49,23 @@
class GumpEngine:
def preprocess(self,run,exitOnError=1):
+
#
# Perform start-up logic
#
workspace = run.getWorkspace()
+
+ logResourceUtilization('Before check environment')
#
#
#
workspace.checkEnvironment(exitOnError)
+
+ logResourceUtilization('After check environment')
+
#
# Modify the log on the fly, if --dated
#
@@ -107,30 +113,44 @@
pass
def integrate(self,run):
-
+
+ logResourceUtilization('Before preprocess')
+
#
# Prepare the context
#
self.preprocess(run)
+
+ logResourceUtilization('Before update')
+
#
# Checkout from source code repositories
#
self.update(run)
-
+
+ logResourceUtilization('Before build')
+
#
# Run the build commands
#
self.buildAll(run)
+
+ logResourceUtilization('Before statistics')
+
# Update [or load if not 'all'] Statistics
self.updateStatistics(run)
+
+ logResourceUtilization('Before syndicate')
#
# Provide a news feed (or few)
#
syndicate(run)
-
+
+ logResourceUtilization('Before document')
+
#
# Build HTML Result (via Forrest or ...)
#
@@ -148,6 +168,8 @@
log.info('Nag about failures... ')
+ logResourceUtilization('Before nag')
+
#
# Nag about failures
#
1.20 +14 -7 jakarta-gump/python/gump/integrate.py
Index: integrate.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/integrate.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- integrate.py 13 Feb 2004 22:12:37 -0000 1.19
+++ integrate.py 23 Feb 2004 21:55:35 -0000 1.20
@@ -82,6 +82,7 @@
from gump.engine import GumpEngine
from gump.gumprun import GumpRun, GumpRunOptions, GumpSet
from gump.utils.commandLine import handleArgv
+from gump.utils import logResourceUtilization
from gump.model.loader import WorkspaceLoader
@@ -100,8 +101,10 @@
# Process command line
args = handleArgv(sys.argv)
ws=args[0]
- ps=args[1]
-
+ ps=args[1]
+
+ logResourceUtilization('Before load workspace')
+
# get parsed workspace definition
workspace=WorkspaceLoader().load(ws)
@@ -113,7 +116,9 @@
# Dated means add the date to the log dir...
#
if '-d' in args or '--dated' in args:
- options.setDated(1)
+ options.setDated(1)
+
+ logResourceUtilization('Before create run')
# The Run Details...
run=GumpRun(workspace,ps,options)
@@ -123,8 +128,10 @@
#
result = GumpEngine().integrate(run)
+ logResourceUtilization('Before exit')
+
#
- log.info('Gump Integration complete. Exit code:' + str(result))
+ log.info('Gump Integration complete. Exit code:' + str(result))
# bye!
sys.exit(result)
1.20 +23 -3 jakarta-gump/python/gump/utils/__init__.py
Index: __init__.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/utils/__init__.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- __init__.py 23 Feb 2004 15:43:06 -0000 1.19
+++ __init__.py 23 Feb 2004 21:55:35 -0000 1.20
@@ -362,6 +362,24 @@
if s[-1] == "\n":
s = s[:-1]
return s
+
+def logResourceUtilization(message=None,):
+ try:
+ import resource
+
+ if not message:
+ message=''
+
+ resources=resource.getrusage(resource.RUSAGE_SELF)
+ log.debug('My Resources ' + message + ' ' + `resources`)
+
+ resources=resource.getrusage(resource.RUSAGE_CHILDREN)
+ log.debug('Child Resources ' + message + ' ' + `resources`)
+
+ resources=resource.getrusage(resource.RUSAGE_BOTH)
+ log.debug('All Resources ' + message + ' ' + `resources`)
+
+ except: pass
if __name__=='__main__':
@@ -381,4 +399,6 @@
print "str = " + getStringFromUnicode("Ceki G�lc�")
print "indent = [" + getIndent(5) + "]"
+
+ logResourceUtilization()
1.16 +5 -4 jakarta-gump/python/gump/output/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/output/nag.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- nag.py 23 Feb 2004 20:55:08 -0000 1.15
+++ nag.py 23 Feb 2004 21:55:35 -0000 1.16
@@ -260,7 +260,8 @@
if not toaddr: toaddr = self.workspace.mailinglist
if not fromaddr : fromaddr = self.workspace.email
- nags.append(AddressPair(toaddr,fromaddr))
+ nags.append(AddressPair(getStringFromUnicode(toaddr), \
+ getStringFromUnicode(fromaddr)))
return nags
1.79 +9 -4 jakarta-gump/python/gump/document/forrest.py
Index: forrest.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- forrest.py 23 Feb 2004 20:55:08 -0000 1.78
+++ forrest.py 23 Feb 2004 21:55:35 -0000 1.79
@@ -1412,9 +1412,14 @@
stream.close()
def documentSummary(self,xdocNode,summary,description='Project Summary'):
- if not summary or not summary.projects: return
+ if not summary or not summary.projects \
+ or not (summary.projects > 1) : return
summarySection=xdocNode.createSection(description)
+
+ summarySection.createParagraph('Overall project success : ' + \
+ '%02.2f' % summary.overallPercentage + '%')
+
summaryTable=summarySection.createTable(['Projects','Successes','Failures','Prereqs',
\
'No Works','Packages'])
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]