ajack       2003/10/26 21:36:58

  Modified:    python/gump context.py statistics.py document.py
  Log:
  1) Add 'sequence In same State' to stats
  2) Display maximum (across projects in module) of this in TODOs
  3) Make module stats an icon with link
  4) Wrap bootclasspath
  
  Revision  Changes    Path
  1.31      +14 -3     jakarta-gump/python/gump/context.py
  
  Index: context.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/context.py,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- context.py        26 Oct 2003 18:38:05 -0000      1.30
  +++ context.py        27 Oct 2003 05:36:58 -0000      1.31
  @@ -663,7 +663,10 @@
           return round(fogFactor/fogFactors,2)
            
       # Get a summary of states for each project
  -    def getProjectSummary(self,summary=None):            
  +    def getProjectSummary(self,summary=None):  
  +    
  +        if hasattr(self,'summary'): return self.summary
  +        
           if not summary: 
               summary=Summary()
           
  @@ -672,7 +675,10 @@
           #
           for ctxt in self:
               summary.addState(ctxt.getStatePair())
  -            
  +        
  +        # Store for later...
  +        self.summary = summary
  +        
           return summary
              
   class GumpContext(Context):
  @@ -778,7 +784,9 @@
                       print "Unknown Project : " + option.project
           
       # Get a summary of states for each project
  -    def getProjectSummary(self,summary=None):            
  +    def getProjectSummary(self,summary=None): 
  +        if hasattr(self,'summary'): return self.summary
  +                
           if not summary: 
               summary=Summary()
           
  @@ -787,6 +795,9 @@
           for ctxt in self:
               ctxt.getProjectSummary(summary)
               
  +        # Store for later...
  +        self.summary = summary
  +        
           return summary
                       
   if __name__=='__main__':
  
  
  
  1.4       +17 -2     jakarta-gump/python/gump/statistics.py
  
  Index: statistics.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/statistics.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- statistics.py     13 Oct 2003 18:51:20 -0000      1.3
  +++ statistics.py     27 Oct 2003 05:36:58 -0000      1.4
  @@ -85,6 +85,7 @@
           self.last=''
           self.currentState=STATUS_UNSET
           self.previousState=STATUS_UNSET
  +        self.sequenceInState=0
           
       def getFOGFactor(self):
           return (self.successes - self.failures - self.prereqs)
  @@ -113,6 +114,9 @@
       def previousStateKey(self):
           return self.projectname + '-previous-state'
           
  +    def sequenceInStateKey(self):
  +        return self.projectname + '-state-seq'
  +        
   class StatisticsDB:
       """Statistics Interface"""
   
  @@ -137,6 +141,7 @@
           s.last=self.getDate(s.lastKey())
           s.currentState=stateForName(self.get(s.currentStateKey()))
           s.previousState=stateForName(self.get(s.previousStateKey()))
  +        s.sequenceInState=self.getInt(s.sequenceInStateKey())
           return s
       
       def putProjectStats(self,s):
  @@ -148,6 +153,7 @@
           self.putDate(s.lastKey(), s.last)
           self.put(s.currentStateKey(), stateName(s.currentState))
           self.put(s.previousStateKey(), stateName(s.previousState))
  +        self.putInt(s.sequenceInStateKey(), s.sequenceInState)
           
       def delProjectStats(self,s):
           try:
  @@ -182,6 +188,10 @@
               del self.db[s.previousStateKey()]
           except:
               """ Hopefully means it wasn't there... """
  +        try:
  +            del self.db[s.sequenceInStateKey()]
  +        except:
  +            """ Hopefully means it wasn't there... """
           
       def get(self,key):
           val=''
  @@ -218,8 +228,9 @@
       db=StatisticsDB()       
       for modulecontext in context:
           for projectcontext in modulecontext:
  -            if projectFilterList and not projectcontext.project in 
projectFilterList: continue  
  +            # if projectFilterList and not projectcontext.project in 
projectFilterList: continue  
           
  +            # Load the statistics
               s=db.getProjectStats(projectcontext.name)
               
               #
  @@ -242,8 +253,12 @@
                   s.failures += 1
                   
               #
  -            # Deal with state changes...
  +            # Deal with states & changes...
               #
  +            if s.previousState==s.currentState:
  +                s.sequenceInState += 1
  +            else:
  +                s.sequenceInState = 1
               s.previousState=s.currentState
               s.currentState=projectcontext.status
               
  
  
  
  1.96      +42 -13    jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- document.py       26 Oct 2003 17:43:07 -0000      1.95
  +++ document.py       27 Oct 2003 05:36:58 -0000      1.96
  @@ -334,10 +334,12 @@
       x=startXDoc(getWorkspaceDocument(workspace,wdir,'todos'))    
       headerXDoc(x,'Modules with TODOs')    
       
  +    documentSummary(x,context.getProjectSummary())
  +    
       startSectionXDoc(x,'Modules with TODOs')
       startTableXDoc(x)
       x.write('     <tr>')        
  -    x.write('      <th>Name</th><th>Module State</th><th>Project 
State(s)</th><th>Elapsed Time</th>')
  +    x.write('      <th>Name</th><th>Duration</th><th>Module State</th><th>Project 
State(s)</th><th>Elapsed Time</th>')
       x.write('     </tr>')
       mcount=0
       for mctxt in context:
  @@ -354,13 +356,28 @@
                   todos=1
                   
           if not todos: continue
  -    
  +
  +        # Shown something...
           mcount+=1
  +        
  +        # Determine longest sequence in this (failed) state...
  +        seq=0
  +        for pctxt in mctxt:
  +            if pctxt.status==STATUS_FAILED:
  +                # Note: Leverages previous extraction from project statistics DB
  +                if not hasattr(pctxt,'stats'):
  +                    # Extract from project statistics DB
  +                    stats=db.getProjectStats(pctxt.name)
  +                    pctxt.stats=stats
  +                stats=pctxt.stats
  +    
  +                if stats.sequenceInState > seq: seq = stats.sequenceInState
   
           x.write('     <tr><!-- %s -->\n' % (mname))        
  -        x.write('      <td><link 
href=\'%s\'>%s</link></td><td>%s</td><td>%s</td>\n' % \
  +        x.write('      <td><link 
href=\'%s\'>%s</link></td><td>%s</td><td>%s</td><td>%s</td>\n' % \
             (getModuleRelativeUrl(mname),mname,        \
  -              getStatePairIcon(mctxt.getStatePair()),        \
  +              seq, \
  +              getStateIcon(mctxt),   \
                 getStateIcons(mctxt)))    
           x.write('      <td>%s</td>\n' % elapsedTimeToString(mctxt.elapsedTime()))   
 
           x.write('     </tr>\n\n')
  @@ -379,6 +396,8 @@
       x=startXDoc(getWorkspaceDocument(workspace,wdir,'modules'))      
       headerXDoc(x,'All Modules')
       
  +    documentSummary(x,context.getProjectSummary())
  +    
       startSectionXDoc(x,'All Modules')
       startTableXDoc(x)
       x.write('     <tr>')        
  @@ -398,7 +417,7 @@
           x.write('     <tr><!-- %s -->\n' % (mname))        
           x.write('      <td><link 
href=\'%s\'>%s</link></td><td>%s</td><td>%s</td>\n' % \
             (getModuleRelativeUrl(mname),mname,\
  -              getStatePairIcon(mctxt.getStatePair()),        \
  +              getStateIcon(mctxt),   \
                 getStateIcons(mctxt)))    
           x.write('      <td>%s</td>\n' % elapsedTimeToString(mctxt.elapsedTime()))   
 
           x.write('     </tr>\n\n')
  @@ -499,14 +518,15 @@
       for projectcontext in modulecontext:
           # :TODO: Dig in and get the first 'failed' 
           # launched task to use as link
  -        
  -        # :TODO: Wrap (via paragraph?) after a
  -        # small number, 5 or so...
  -        icon=getStatePairIcon(projectcontext.getStatePair())
  -        href=getContextLink(projectcontext,0,icon)
  +        href=getStateIcon(projectcontext)
           icons+=href+' '
       return icons
       
  +def getStateIcon(context):
  +    icon=getStatePairIcon(context.getStatePair())
  +    href=getContextLink(context,0,icon)
  +    return href
  +    
   def 
documentModule(workspace,context,wdir,modulename,modulecontext,db,projectFilterList=None):
       mdir=getModuleDir(workspace,modulename,wdir)
       
  @@ -651,9 +671,13 @@
   
       documentAnnotations(x,projectcontext.annotations)
       
  -    # Extract from project statistics DB
  -    stats=db.getProjectStats(projectname)
  - 
  +    # Note: Leverages previous extraction from project statistics DB
  +    if not hasattr(projectcontext,'stats'):
  +        # Extract from project statistics DB
  +        stats=db.getProjectStats(projectname)
  +        projectcontext.stats=stats
  +    stats=projectcontext.stats
  +    
       startSectionXDoc(x,'Details')
       startListXDoc(x)
       addItemXDoc(x,"Status: ", stateName(projectcontext.status))  
  @@ -859,6 +883,8 @@
           else:
               addItemXDoc(x,"Output: None")
               
  +        if work.result.signal:
  +            addItemXDoc(x,"Termination Signal: ", str(work.result.signal))
           addItemXDoc(x,"Exit Code: ", str(work.result.exit_code))
           
           
  @@ -889,6 +915,9 @@
                   x.write(param.name)
                   x.write('</td><td>')
                   val = param.value
  +                # :TODO: Hack for BOOTCLASSPATH
  +                if param.name.startswith('bootclasspath'):
  +                   val=':\n'.join(val.split(':'))
                   if val:
                       x.write(val)
                   else:
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to