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/07/13 23:43:32 UTC
cvs commit: gump/python/gump/stats statsdb.py
ajack 2004/07/13 14:43:32
Modified: python/gump/document/xdocs documenter.py
python/gump/stats statsdb.py
Log:
Docs tweaks (less is more).
Revision Changes Path
1.15 +46 -35 gump/python/gump/document/xdocs/documenter.py
Index: documenter.py
===================================================================
RCS file: /home/cvs/gump/python/gump/document/xdocs/documenter.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- documenter.py 13 Jul 2004 18:44:36 -0000 1.14
+++ documenter.py 13 Jul 2004 21:43:31 -0000 1.15
@@ -607,6 +607,7 @@
detailsTable.createEntry("Prefix: ", self.workspace.prefix)
detailsTable.createEntry("Signature: ", self.workspace.signature)
+ self.documentStats(document,self.workspace)
self.documentProperties(detailsSection, self.workspace, 'Workspace Properties')
# Does this self.workspace send notification (nag) mails?
@@ -1576,6 +1577,7 @@
if not pcount: pallTable.createLine('None')
+ self.documentStats(document,module,realTime)
self.documentFileList(document,module,'Module-level Files')
self.documentWorkList(document,module,'Module-level Work')
@@ -1751,41 +1753,7 @@
if metadataLocation and metadataUrl:
detailsList.createEntry('Gump Metadata: ').createFork(metadataUrl, metadataLocation)
- # Note: Leverages previous extraction from project statistics DB
- stats=project.getStats()
-
- statsSection=document.createSection('Statistics')
-
- #
- # Start annotating with issues...
- #
- if project.isNotOk() and stats.sequenceInState >= SIGNIFICANT_DURATION:
- statsSection.createWarning( \
- 'This project has existed in this failed state for a significant duration.')
-
- statsTable=statsSection.createTable()
-
- if (not realTime) and self.config.isXdocs():
- # Generate an SVG for FOG:
- (file,title) = self.diagramFOG(project)
- if file:
- statsTable.createEntry("FOG Factor: ").createData().createIcon(file,title)
-
- statsTable.createEntry("FOG Factor: ", '%02.2f' % stats.getFOGFactor())
- statsTable.createEntry('Dependency Depth: ', project.getDependencyDepth())
- statsTable.createEntry('Total Dependency Depth: ', project.getTotalDependencyDepth())
- statsTable.createEntry("Successes: ", stats.successes)
- statsTable.createEntry("Failures: ", stats.failures)
- statsTable.createEntry("Prerequisite Failures: ", stats.prereqs)
- statsTable.createEntry("Current State: ", stateDescription(stats.currentState))
- statsTable.createEntry("Duration in state: ", stats.sequenceInState)
- statsTable.createEntry("Start of state: ", secsToDateTime(stats.startOfState))
- statsTable.createEntry("Previous State: ", stateDescription(stats.previousState))
-
- if stats.first:
- statsTable.createEntry("First Success: ", secsToDateTime(stats.first))
- if stats.last:
- statsTable.createEntry("Last Success: ", secsToDateTime(stats.last))
+ self.documentStats(document,project,realTime)
self.documentFileList(document,project,'Project-level Files')
@@ -1934,6 +1902,49 @@
# footerXDoc(x)
# endXDoc(x)
+ def documentStats(self,node,entity,realTime=False):
+
+ # Note: Leverages previous extraction from project statistics DB
+ stats=entity.getStats()
+
+ statsSection=node.createSection('Statistics')
+
+ # Start annotating with issues...
+ if entity.isNotOk() and stats.sequenceInState >= SIGNIFICANT_DURATION:
+ statsSection.createWarning( \
+ 'This entity has existed in this failed state for a significant duration.')
+
+ statsTable=statsSection.createTable()
+
+ if not isinstance(entity,Workspace):
+ if (not realTime) and self.config.isXdocs():
+ # Generate an SVG for FOG:
+ (file,title) = self.diagramFOG(entity)
+ if file:
+ statsTable.createEntry("FOG Factor: ").createData().createIcon(file,title)
+
+ statsTable.createEntry("FOG Factor: ", '%02.2f' % stats.getFOGFactor())
+
+ if isinstance(entity,Project):
+ statsTable.createEntry('Dependency Depth: ', entity.getDependencyDepth())
+ statsTable.createEntry('Total Dependency Depth: ', entity.getTotalDependencyDepth())
+
+ statsTable.createEntry("Successes: ", stats.successes)
+ statsTable.createEntry("Failures: ", stats.failures)
+
+ if not isinstance(entity,Workspace):
+ statsTable.createEntry("Prerequisite Failures: ", stats.prereqs)
+
+ statsTable.createEntry("Current State: ", stateDescription(stats.currentState))
+ statsTable.createEntry("Duration in state: ", stats.sequenceInState)
+ statsTable.createEntry("Start of state: ", secsToDateTime(stats.startOfState))
+ statsTable.createEntry("Previous State: ", stateDescription(stats.previousState))
+
+ if stats.first:
+ statsTable.createEntry("First Success: ", secsToDateTime(stats.first))
+ if stats.last:
+ statsTable.createEntry("Last Success: ", secsToDateTime(stats.last))
+
def displayClasspath(self,document,classpath,title,referencingObject):
if not classpath.getPathParts(): return
1.5 +37 -3 gump/python/gump/stats/statsdb.py
Index: statsdb.py
===================================================================
RCS file: /home/cvs/gump/python/gump/stats/statsdb.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- statsdb.py 8 Jul 2004 20:33:09 -0000 1.4
+++ statsdb.py 13 Jul 2004 21:43:32 -0000 1.5
@@ -33,7 +33,9 @@
from gump.shared.comparator import *
class StatisticsDB:
- """Statistics Interface"""
+ """
+ Statistics Database Interface
+ """
def __init__(self,dbdir=None,name=None):
if not name: name='stats.db'
@@ -43,6 +45,7 @@
if not os.path.exists(self.dbpath):
log.info('*New* Statistics Database:' + self.dbpath)
+ # Unfortuantely Python on M$ does not have an implementation (yet)
log.debug('Open Statistic Database:' + self.dbpath)
if not os.name == 'dos' and not os.name == 'nt':
self.db = anydbm.open(self.dbpath,'c')
@@ -50,6 +53,9 @@
self.db={}
def dumpProjects(self):
+ """
+ Show all that is there
+ """
for key in self.db.keys():
if not -1 == key.find('-pname'):
pname=key[0:len(key)-6]
@@ -139,6 +145,9 @@
self.putInt(stats.sequenceInStateKey(), stats.sequenceInState)
def delBaseStats(self,stats):
+ """
+ Store the common stats
+ """
try:
del self.db[stats.nameKey()]
except:
@@ -193,12 +202,18 @@
return val
def getFloat(self,key):
+ """
+ Get a float from the DB
+ """
key=str(key)
val=0.0
if self.db.has_key(key): val=float(self.db[key])
return val
def getDate(self,key):
+ """
+ Get a date from the DB
+ """
dateF=self.getFloat(key)
# Hack to patch values incorrectly set to 0
@@ -212,12 +227,24 @@
self.db[str(key)]=val
def putInt(self,key,val=0):
+ """
+ Store an int
+ """
self.db[str(key)]=str(val)
def putDate(self,key,val=-1):
+ """
+ Store a date (as an int)
+ """
self.putInt(str(key),val)
def loadStatistics(self,workspace):
+ """
+
+ Load statistics from the DB onto the objects, so they can
+ reference the latest information (e.g. to set -debug)
+
+ """
log.debug('--- Loading Statistics')
@@ -225,7 +252,6 @@
ws=self.getWorkspaceStats(workspace.getName())
workspace.setStats(ws)
-
for repo in workspace.getRepositories():
# Load the statistics
@@ -248,8 +274,12 @@
# Stash for later...
project.setStats(ps)
-
def updateStatistics(self,workspace):
+ """
+
+ Go through the tree updating statistics as you go...
+
+ """
log.debug('--- Updating Statistics')
# Load the W/S statistics
@@ -300,6 +330,10 @@
self.sync()
def sync(self):
+ """
+ Try to sync the DB to disk (assuming it has a sync, which
+ some implementations do not).
+ """
if hasattr(self.db, 'sync'):
self.db.sync()
---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org