You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2004/03/02 22:11:40 UTC
cvs commit: gump/python/gump/test nagging.py
ajack 2004/03/02 13:11:40
Modified: python/gump/results resulter.py loader.py
python/gump check.py engine.py
. gumpy.py
python/gump/output nag.py
python/gump/test nagging.py
Log:
1) Bug fixes to gumpy.py
2) Bug fixes to results.xml (and downloading, visualizing)
3) Bug fixes to gump/check.py [that checks a workspace]
Revision Changes Path
1.8 +15 -6 gump/python/gump/results/resulter.py
Index: resulter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/results/resulter.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- resulter.py 1 Mar 2004 21:28:00 -0000 1.7
+++ resulter.py 2 Mar 2004 21:11:39 -0000 1.8
@@ -110,7 +110,7 @@
elif isinstance(object,Project):
result=serverResults.getProjectResult(name)
else:
- raise RuntimeError('Not understood')
+ raise RuntimeError('Object [' + object.__class__.__name__ + '] NOT understood for Results')
if result:
results[server] = result
@@ -118,21 +118,30 @@
return results
def loadResultsForServers(self):
+
+ if self.serversLoaded: return
+
for server in self.workspace.getServers():
if not server in self.serverResults:
results=None
try:
- results=loadResultsForServer(server)
- except:
- pass
+ results=self.loadResultsForServer(server)
+ except Exception, details:
+ log.warn('Failed to load results for [' + str(server) + '] : ' \
+ + str(details), exc_info=1)
+
if results:
+ self.workspace.addInfo('Loaded results for server [' + str(server) + ']')
self.serverResults(server, results)
+
+ self.serversLoaded=1
def loadResultsForServer(self, server):
- return loadResults(server.getUrl() + '/results.xml')
+ return self.loadResults(server.getUrl() + '/results.xml')
def loadResults(self, url):
- loader = WorkspaceResultLoader()
+ loader = WorkspaceResultLoader()
+ log.debug('Load results from URL : [' + url + ']')
return loader.loadFromUrl(url)
def gatherResults(self):
1.3 +1 -0 gump/python/gump/results/loader.py
Index: loader.py
===================================================================
RCS file: /home/cvs/gump/python/gump/results/loader.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- loader.py 28 Feb 2004 00:08:49 -0000 1.2
+++ loader.py 2 Mar 2004 21:11:39 -0000 1.3
@@ -69,6 +69,7 @@
from gump.results.model import WorkspaceResult
from gump.utils.note import transferAnnotations, Annotatable
+from gump.utils.http import cacheHTTP
from gump.utils import dump
from gump.config import gumpPath
1.37 +4 -4 gump/python/gump/check.py
Index: check.py
===================================================================
RCS file: /home/cvs/gump/python/gump/check.py,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- check.py 5 Feb 2004 05:43:56 -0000 1.36
+++ check.py 2 Mar 2004 21:11:39 -0000 1.37
@@ -112,7 +112,7 @@
result = GumpEngine().check(run)
#
- log.info('Gump Integration complete. Exit code:' + str(result))
+ log.info('Gump Check complete. Exit code:' + str(result))
# bye!
sys.exit(result)
1.69 +17 -2 gump/python/gump/engine.py
Index: engine.py
===================================================================
RCS file: /home/cvs/gump/python/gump/engine.py,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- engine.py 1 Mar 2004 21:28:00 -0000 1.68
+++ engine.py 2 Mar 2004 21:11:39 -0000 1.69
@@ -208,6 +208,14 @@
self.preprocess(run, 0)
#
+ # Load the statistics (so we can use them during
+ # other operations).
+ #
+ logResourceUtilization('Before load statistics')
+ self.loadStatistics(run)
+
+
+ #
# Check the metadata
#
self.checkWorkspace(run)
@@ -396,14 +404,21 @@
repository=run.getOutputsRepository()
# build all projects this project depends upon, then the project itself
+ projectCount=len(list)
+ projectNo=1
for project in list:
+
+ log.info(' ------ Project: #[' + `projectNo` + '] of [' + `projectCount` + '] : ' + project.getName())
+
+
if project.isPackaged(): continue
+
# Do this even if not ok
self.performPreBuild( run, project )
if project.okToPerformWork():
- log.debug(' ------ Building: ' + project.getName())
+ log.debug(' ------ Building: [' + `projectNo` + '] ' + project.getName())
cmd=project.getBuildCommand()
@@ -429,7 +444,7 @@
self.performPostBuild( run, project, repository )
if not project.okToPerformWork():
- log.warn('Failed to build project [' + project.getName() + '], state:' \
+ log.warn('Failed to build project #[' + `projectNo` + '] [' + project.getName() + '], state:' \
+ project.getStateDescription())
1.8 +5 -11 gump/gumpy.py
Index: gumpy.py
===================================================================
RCS file: /home/cvs/gump/gumpy.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- gumpy.py 1 Mar 2004 21:56:23 -0000 1.7
+++ gumpy.py 2 Mar 2004 21:11:39 -0000 1.8
@@ -182,7 +182,7 @@
# Enable a log
logFile=os.path.abspath('gumpy.log')
-log=open(logFile,'w')
+log=open(logFile,'w',0) # Unbuffered...
result=0
@@ -210,8 +210,7 @@
workspaceName = hostname + '.xml'
if os.environ.has_key('GUMP_WORKSPACE'):
- workspaceName = os.environ['GUMP_WORKSPACE'] + '.xml'
-
+ workspaceName = os.environ['GUMP_WORKSPACE'] + '.xml'
workspacePath = os.path.abspath(workspaceName)
projectsExpr='all'
@@ -285,14 +284,9 @@
if not result:
#
#
- # Process command line
- #
- args=''
- for arg in sys.argv[1:]:
- if args: args += ' '
- args += arg
-
- iargs = '-w ../' + workspaceName + ' ' + projectsExpr + args
+ # Process/build command line
+ #
+ iargs = '-w ../' + workspaceName + ' ' + projectsExpr + ' ' + ' '.join(sys.argv[1:])
#
# Run the main Gump...
1.19 +55 -11 gump/python/gump/output/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/gump/python/gump/output/nag.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- nag.py 29 Feb 2004 19:16:19 -0000 1.18
+++ nag.py 2 Mar 2004 21:11:39 -0000 1.19
@@ -78,7 +78,8 @@
from gump.net.mailer import *
from gump.utils import *
-LINE='- - - - - -- -- ------------------------------------ G U M P'
+LINE ='- - - - - -- -- ------------------------------------ G U M P'
+SEPARATOR='******************************************************** G U M P'
class AddressPair:
def __init__(self,toAddr,fromAddr):
@@ -102,8 +103,12 @@
self.gumpSet=run.getGumpSet()
self.unsent=''
- self.unwanted=''
+ self.unsentSubjects=''
+ self.unsents=0
+ self.unwanted=''
+ self.unwantedSubjects=''
+ self.unwanteds=0
def nag(self):
@@ -155,11 +160,14 @@
log.info('We have some unwanted\'s to send to list...')
self.sendEmail(self.workspace.mailinglist,self.workspace.email, \
- 'All dressed up, with nowhere to go...',self.unwanted)
+ 'BATCH: All dressed up, with nowhere to go...',\
+ self.getUnwantedContent())
# A bit paranoid, ought just rely upon object being
# destroyed,
- self.unwanted=''
+ self.unwanted=''
+ self.unwantedSubjects=''
+ self.unwanteds=0
else:
log.info('No unwanted nags.')
@@ -167,30 +175,66 @@
if self.hasUnsent():
log.info('We have some unsented\'s to send to list...')
self.sendEmail(self.workspace.mailinglist,self.workspace.email, \
- 'Unable to send...',self.unsent)
+ 'BATCH: Unable to send...',self.unsent)
# A bit paranoid, ought just rely upon object being
# destroyed,
self.unsent=''
+ self.unsentSubjects=''
+ self.unsents=0
else:
log.info('No unsent nags.')
def addUnwanted(self,subject,content):
if self.unwanted:
- self.unwanted += '-------------------------------------------------------------\n'
+ self.unwanted += SEPARATOR
+ self.unwanted += '\n'
self.unwanted += subject
self.unwanted += '\n'
self.unwanted += content
self.unwanted += '\n'
+
+ self.unwantedSubjects += subject
+ self.unwanteds += 1
def addUnsent(self,subject,content):
if self.unsent:
- self.unsent += '-------------------------------------------------------------\n'
+ self.unsent += SEPARATOR
+ self.unsent += '\n'
self.unsent += subject
self.unsent += '\n'
self.unsent += content
self.unsent += '\n'
-
+
+ self.unsentSubjects += subject
+ self.unsents += 1
+
+ def getUnwantedContent(self):
+ content = ''
+
+ if self.unwanteds:
+ plural=''
+ if self.unwanted > 0:
+ plural='s'
+
+ content = """Dear Gumpmeisters,
+
+The following %s nag%s could have been sent (if requested)
+
+""" % (`self.unwanteds`, plural)
+
+ content += SEPARATOR
+ content += '\n'
+
+ content += self.unwantedSubjects
+
+ content += SEPARATOR
+ content += '\n'
+
+ content += self.unwanted
+
+ return content
+
def hasUnwanted(self):
if self.unwanted: return 1
return 0
1.5 +3 -0 gump/python/gump/test/nagging.py
Index: nagging.py
===================================================================
RCS file: /home/cvs/gump/python/gump/test/nagging.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- nagging.py 17 Feb 2004 21:54:21 -0000 1.4
+++ nagging.py 2 Mar 2004 21:11:39 -0000 1.5
@@ -144,6 +144,9 @@
'Test Subject', \
'Test Content')
#print str(email)
+
+ nagger.getUnwantedContent()
+ nagger.getSentContent()
def testNag(self):
nag(self.run)
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org
Re: cvs commit: gump/python/gump/test nagging.py
Posted by "Adam R. B. Jack" <aj...@trysybase.com>.
Ah yes, some nagging changes (for Nick's request) slipped in there..
regards
Adam
----- Original Message -----
From: <aj...@apache.org>
To: <gu...@apache.org>
Sent: Tuesday, March 02, 2004 2:11 PM
Subject: cvs commit: gump/python/gump/test nagging.py
> ajack 2004/03/02 13:11:40
>
> Modified: python/gump/results resulter.py loader.py
> python/gump check.py engine.py
> . gumpy.py
> python/gump/output nag.py
> python/gump/test nagging.py
> Log:
> 1) Bug fixes to gumpy.py
> 2) Bug fixes to results.xml (and downloading, visualizing)
> 3) Bug fixes to gump/check.py [that checks a workspace]
>
> Revision Changes Path
> 1.8 +15 -6 gump/python/gump/results/resulter.py
>
> Index: resulter.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/results/resulter.py,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- resulter.py 1 Mar 2004 21:28:00 -0000 1.7
> +++ resulter.py 2 Mar 2004 21:11:39 -0000 1.8
> @@ -110,7 +110,7 @@
> elif isinstance(object,Project):
> result=serverResults.getProjectResult(name)
> else:
> - raise RuntimeError('Not understood')
> + raise RuntimeError('Object [' +
object.__class__.__name__ + '] NOT understood for Results')
>
> if result:
> results[server] = result
> @@ -118,21 +118,30 @@
> return results
>
> def loadResultsForServers(self):
> +
> + if self.serversLoaded: return
> +
> for server in self.workspace.getServers():
> if not server in self.serverResults:
> results=None
> try:
> - results=loadResultsForServer(server)
> - except:
> - pass
> + results=self.loadResultsForServer(server)
> + except Exception, details:
> + log.warn('Failed to load results for [' +
str(server) + '] : ' \
> + + str(details), exc_info=1)
> +
> if results:
> + self.workspace.addInfo('Loaded results for server
[' + str(server) + ']')
> self.serverResults(server, results)
> +
> + self.serversLoaded=1
>
> def loadResultsForServer(self, server):
> - return loadResults(server.getUrl() + '/results.xml')
> + return self.loadResults(server.getUrl() + '/results.xml')
>
> def loadResults(self, url):
> - loader = WorkspaceResultLoader()
> + loader = WorkspaceResultLoader()
> + log.debug('Load results from URL : [' + url + ']')
> return loader.loadFromUrl(url)
>
> def gatherResults(self):
>
>
>
> 1.3 +1 -0 gump/python/gump/results/loader.py
>
> Index: loader.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/results/loader.py,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- loader.py 28 Feb 2004 00:08:49 -0000 1.2
> +++ loader.py 2 Mar 2004 21:11:39 -0000 1.3
> @@ -69,6 +69,7 @@
> from gump.results.model import WorkspaceResult
>
> from gump.utils.note import transferAnnotations, Annotatable
> +from gump.utils.http import cacheHTTP
> from gump.utils import dump
> from gump.config import gumpPath
>
>
>
>
> 1.37 +4 -4 gump/python/gump/check.py
>
> Index: check.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/check.py,v
> retrieving revision 1.36
> retrieving revision 1.37
> diff -u -r1.36 -r1.37
> --- check.py 5 Feb 2004 05:43:56 -0000 1.36
> +++ check.py 2 Mar 2004 21:11:39 -0000 1.37
> @@ -112,7 +112,7 @@
> result = GumpEngine().check(run)
>
> #
> - log.info('Gump Integration complete. Exit code:' + str(result))
> + log.info('Gump Check complete. Exit code:' + str(result))
>
> # bye!
> sys.exit(result)
>
>
>
> 1.69 +17 -2 gump/python/gump/engine.py
>
> Index: engine.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/engine.py,v
> retrieving revision 1.68
> retrieving revision 1.69
> diff -u -r1.68 -r1.69
> --- engine.py 1 Mar 2004 21:28:00 -0000 1.68
> +++ engine.py 2 Mar 2004 21:11:39 -0000 1.69
> @@ -208,6 +208,14 @@
> self.preprocess(run, 0)
>
> #
> + # Load the statistics (so we can use them during
> + # other operations).
> + #
> + logResourceUtilization('Before load statistics')
> + self.loadStatistics(run)
> +
> +
> + #
> # Check the metadata
> #
> self.checkWorkspace(run)
> @@ -396,14 +404,21 @@
> repository=run.getOutputsRepository()
>
> # build all projects this project depends upon, then the
project itself
> + projectCount=len(list)
> + projectNo=1
> for project in list:
> +
> + log.info(' ------ Project: #[' + `projectNo` + '] of [' +
`projectCount` + '] : ' + project.getName())
> +
> +
> if project.isPackaged(): continue
>
> +
> # Do this even if not ok
> self.performPreBuild( run, project )
>
> if project.okToPerformWork():
> - log.debug(' ------ Building: ' + project.getName())
> + log.debug(' ------ Building: [' + `projectNo` + '] ' +
project.getName())
>
> cmd=project.getBuildCommand()
>
> @@ -429,7 +444,7 @@
> self.performPostBuild( run, project, repository )
>
> if not project.okToPerformWork():
> - log.warn('Failed to build project [' +
project.getName() + '], state:' \
> + log.warn('Failed to build project #[' + `projectNo` +
'] [' + project.getName() + '], state:' \
> + project.getStateDescription())
>
>
>
>
>
> 1.8 +5 -11 gump/gumpy.py
>
> Index: gumpy.py
> ===================================================================
> RCS file: /home/cvs/gump/gumpy.py,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- gumpy.py 1 Mar 2004 21:56:23 -0000 1.7
> +++ gumpy.py 2 Mar 2004 21:11:39 -0000 1.8
> @@ -182,7 +182,7 @@
>
> # Enable a log
> logFile=os.path.abspath('gumpy.log')
> -log=open(logFile,'w')
> +log=open(logFile,'w',0) # Unbuffered...
>
> result=0
>
> @@ -210,8 +210,7 @@
>
> workspaceName = hostname + '.xml'
> if os.environ.has_key('GUMP_WORKSPACE'):
> - workspaceName = os.environ['GUMP_WORKSPACE'] + '.xml'
> -
> + workspaceName = os.environ['GUMP_WORKSPACE'] + '.xml'
> workspacePath = os.path.abspath(workspaceName)
>
> projectsExpr='all'
> @@ -285,14 +284,9 @@
> if not result:
> #
> #
> - # Process command line
> - #
> - args=''
> - for arg in sys.argv[1:]:
> - if args: args += ' '
> - args += arg
> -
> - iargs = '-w ../' + workspaceName + ' ' + projectsExpr +
args
> + # Process/build command line
> + #
> + iargs = '-w ../' + workspaceName + ' ' + projectsExpr + ' '
+ ' '.join(sys.argv[1:])
>
> #
> # Run the main Gump...
>
>
>
> 1.19 +55 -11 gump/python/gump/output/nag.py
>
> Index: nag.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/output/nag.py,v
> retrieving revision 1.18
> retrieving revision 1.19
> diff -u -r1.18 -r1.19
> --- nag.py 29 Feb 2004 19:16:19 -0000 1.18
> +++ nag.py 2 Mar 2004 21:11:39 -0000 1.19
> @@ -78,7 +78,8 @@
> from gump.net.mailer import *
> from gump.utils import *
>
> -LINE='- - - - - -- -- ------------------------------------ G U M P'
> +LINE ='- - - - - -- -- ------------------------------------ G U
M P'
> +SEPARATOR='******************************************************** G U
M P'
>
> class AddressPair:
> def __init__(self,toAddr,fromAddr):
> @@ -102,8 +103,12 @@
> self.gumpSet=run.getGumpSet()
>
> self.unsent=''
> - self.unwanted=''
> + self.unsentSubjects=''
> + self.unsents=0
>
> + self.unwanted=''
> + self.unwantedSubjects=''
> + self.unwanteds=0
>
> def nag(self):
>
> @@ -155,11 +160,14 @@
> log.info('We have some unwanted\'s to send to list...')
>
>
self.sendEmail(self.workspace.mailinglist,self.workspace.email, \
> - 'All dressed up, with nowhere to
go...',self.unwanted)
> + 'BATCH: All dressed up, with nowhere to
go...',\
> + self.getUnwantedContent())
>
> # A bit paranoid, ought just rely upon object being
> # destroyed,
> - self.unwanted=''
> + self.unwanted=''
> + self.unwantedSubjects=''
> + self.unwanteds=0
> else:
> log.info('No unwanted nags.')
>
> @@ -167,30 +175,66 @@
> if self.hasUnsent():
> log.info('We have some unsented\'s to send to list...')
>
self.sendEmail(self.workspace.mailinglist,self.workspace.email, \
> - 'Unable to send...',self.unsent)
> + 'BATCH: Unable to send...',self.unsent)
>
> # A bit paranoid, ought just rely upon object being
> # destroyed,
> self.unsent=''
> + self.unsentSubjects=''
> + self.unsents=0
> else:
> log.info('No unsent nags.')
>
> def addUnwanted(self,subject,content):
> if self.unwanted:
> - self.unwanted +=
'-------------------------------------------------------------\n'
> + self.unwanted += SEPARATOR
> + self.unwanted += '\n'
> self.unwanted += subject
> self.unwanted += '\n'
> self.unwanted += content
> self.unwanted += '\n'
> +
> + self.unwantedSubjects += subject
> + self.unwanteds += 1
>
> def addUnsent(self,subject,content):
> if self.unsent:
> - self.unsent +=
'-------------------------------------------------------------\n'
> + self.unsent += SEPARATOR
> + self.unsent += '\n'
> self.unsent += subject
> self.unsent += '\n'
> self.unsent += content
> self.unsent += '\n'
> -
> +
> + self.unsentSubjects += subject
> + self.unsents += 1
> +
> + def getUnwantedContent(self):
> + content = ''
> +
> + if self.unwanteds:
> + plural=''
> + if self.unwanted > 0:
> + plural='s'
> +
> + content = """Dear Gumpmeisters,
> +
> +The following %s nag%s could have been sent (if requested)
> +
> +""" % (`self.unwanteds`, plural)
> +
> + content += SEPARATOR
> + content += '\n'
> +
> + content += self.unwantedSubjects
> +
> + content += SEPARATOR
> + content += '\n'
> +
> + content += self.unwanted
> +
> + return content
> +
> def hasUnwanted(self):
> if self.unwanted: return 1
> return 0
>
>
>
> 1.5 +3 -0 gump/python/gump/test/nagging.py
>
> Index: nagging.py
> ===================================================================
> RCS file: /home/cvs/gump/python/gump/test/nagging.py,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -r1.4 -r1.5
> --- nagging.py 17 Feb 2004 21:54:21 -0000 1.4
> +++ nagging.py 2 Mar 2004 21:11:39 -0000 1.5
> @@ -144,6 +144,9 @@
> 'Test Subject', \
> 'Test Content')
> #print str(email)
> +
> + nagger.getUnwantedContent()
> + nagger.getSentContent()
>
> def testNag(self):
> nag(self.run)
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
> For additional commands, e-mail: general-help@gump.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org