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 2003/10/16 22:07:43 UTC
cvs commit: jakarta-gump/python/gump launcher.py context.py tools.py nag.py
ajack 2003/10/16 13:07:42
Modified: python/gump launcher.py context.py tools.py nag.py
Log:
Attempt to add 'tail 50' to the nag mails.
Revision Changes Path
1.14 +13 -0 jakarta-gump/python/gump/launcher.py
Index: launcher.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/launcher.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- launcher.py 14 Oct 2003 21:40:39 -0000 1.13
+++ launcher.py 16 Oct 2003 20:07:42 -0000 1.14
@@ -240,7 +240,20 @@
overview += indent+"Elapsed: " + str(self.elapsed)
if self.exit_code:
overview += indent+"ExitCode: " + str(self.exit_code)
+
return overview
+
+ def tail(self,lines):
+ tail = "---------------------------------------------"
+
+ if self.output:
+ tail += gump.tools.tail(self.output,lines)
+ else:
+ tail += "No output"
+
+ tail += "---------------------------------------------"
+
+ return tail
def dump(self,indent):
print self.overview(indent)
1.19 +4 -0 jakarta-gump/python/gump/context.py
Index: context.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/context.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- context.py 9 Oct 2003 04:18:20 -0000 1.18
+++ context.py 16 Oct 2003 20:07:42 -0000 1.19
@@ -200,6 +200,10 @@
def overview(self):
overview=TimedWorkItem.overview(self)
overview += self.command.overview()
+
+ if not workitem.status == STATUS_SUCCESS:
+ overview+=self.result.tail(50)
+
return overview
class WorkList(list):
1.4 +23 -0 jakarta-gump/python/gump/tools.py
Index: tools.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/tools.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tools.py 26 Sep 2003 22:01:34 -0000 1.3
+++ tools.py 16 Oct 2003 20:07:42 -0000 1.4
@@ -114,6 +114,29 @@
return work
+def tail(file,lines):
+ """ Return the last N lines of a file as a list """
+ taillines=[]
+ try:
+ try:
+ # Read lines from the file...
+ o=open(file, 'r')
+ line=o.readline()
+
+ # Store the lines
+ taillines.append(line)
+
+ # But dump any before 'lines'
+ size=len(taillines)
+ if size > lines:
+ del taillines[0:size-lines]
+ finally:
+ if o: o.close()
+ except:
+ x.write('Failed to tail :' + file)
+
+ return taillines
+
if __name__=='__main__':
# init logging
1.16 +1 -1 jakarta-gump/python/gump/nag.py
Index: nag.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/nag.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- nag.py 16 Oct 2003 18:42:28 -0000 1.15
+++ nag.py 16 Oct 2003 20:07:42 -0000 1.16
@@ -183,7 +183,7 @@
if context.worklist:
content+="\n\nWork Items:\n"
for workitem in context.worklist:
- content+=workitem.overview()+"\n"
+ content+=workitem.overview()+"\n"
#
# Link them back here...