gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump gumpy.py
Date Sat, 10 Apr 2004 23:09:29 GMT
ajack       2004/04/10 16:09:29

  Modified:    python/gump/results resulter.py model.py
               python/gump/model server.py workspace.py
               python/gump/document forrest.py
               .        gumpy.py
  Log:
  Tinkering towards:
  
  	http://issues.apache.org/jira/browse/GUMP-49
  
  Revision  Changes    Path
  1.19      +28 -3     gump/python/gump/results/resulter.py
  
  Index: resulter.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/results/resulter.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- resulter.py	16 Mar 2004 23:56:41 -0000	1.18
  +++ resulter.py	10 Apr 2004 23:09:29 -0000	1.19
  @@ -35,6 +35,26 @@
   from gump.results.model import *
   from gump.results.loader import *
   
  +class ResultsSet(dict):
  +    def __init__(self):
  +        dict.__init__(self)
  +        
  +        self.calculated=0
  +        self.differences=0
  +        
  +    def hasDifferences(self):
  +        if self.calculated: return self.differences
  +        
  +        lastPair=None
  +        for result in self.values():
  +            statePair=result.getStatePair()            
  +            if lastPair:
  +                self.differeces=(lastPair <> statePair)                
  +            lastPair=statePair
  +            
  +        self.calculated=1
  +        return self.differences
  +                    
   class Resulter:
       
       def __init__(self,run):        
  @@ -51,9 +71,9 @@
               return results[server]
           
       def getResultsForAllServers(self, object):
  -        results = {}
  +        results = ResultsSet()
           
  -        # Loda on demand
  +        # Load on demand
           if not self.serversLoaded:
               self.loadResultsForServers()
               
  @@ -98,10 +118,14 @@
                       log.debug('Loaded results for server [' + str(server) + ']')
                       self.serverResults[server]=results
                       
  +                    # Probably a hack, but might as well (for now)
  +                    # just wire the server with iht's latest results
  +                    server.setResults(results)
  +                    
           self.serversLoaded=1
               
       def loadResultsForServer(self, server):
  -        return self.loadResults(server.getUrl() + '/results.xml')
  +        return self.loadResults(server.getResultsUrl())
           
       def loadResults(self, url):    
           loader =  WorkspaceResultLoader()
  @@ -206,6 +230,7 @@
       # Generate results around this run...
       resulter=Resulter(run)
       
  +    # In the root.
       where=run.getOptions().getResolver().getFile(run.getWorkspace(),'results','.xml',1)
       
       # Generate the output...
  
  
  
  1.9       +35 -1     gump/python/gump/results/model.py
  
  Index: model.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/results/model.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- model.py	6 Apr 2004 15:57:11 -0000	1.8
  +++ model.py	10 Apr 2004 23:09:29 -0000	1.9
  @@ -138,6 +138,12 @@
       	#
       	self.moduleResults 	=	{}
       	self.projectResults 	=	{}
  +    	
  +    	self.startDateTimeUtc=''
  +    	self.startDateTime=''
  +    	self.endDateTimeUtc=''
  +    	self.endDateTime=''
  +    	self.timezone=''
   
       #
       # Lists...
  @@ -155,7 +161,22 @@
           
       def getProjectResults(self):
           return self.projectResults.values()    
  -    
  +        
  +    def getTimezone(self):
  +        return self.timezone
  +        
  +    def getStartDateTime(self):
  +        return self.startDateTime
  +        
  +    def getStartDateTimeUtc(self):
  +        return self.startDateTimeUtc
  +        
  +    def getEndDateTime(self):
  +        return self.endDateTime
  +        
  +    def getEndDateTimeUtc(self):
  +        return self.endDateTimeUtc
  +        
       #
       # Named...
       #
  @@ -194,6 +215,12 @@
           topElement.setAttribute('name',self.getName())
           topElement.setAttribute('state',self.getStateName())
           topElement.setAttribute('reason',self.getReasonName())
  +        
  +        topElement.setAttribute('startUtc',self.getStartDateTimeUtc())
  +        topElement.setAttribute('start',self.getStartDateTime())
  +        topElement.setAttribute('endUtc',self.getEndDateTimeUtc())
  +        topElement.setAttribute('end',self.getEndDateTime())
  +        topElement.setAttribute('tzone',self.getTimezone())
               
           for moduleResult in self.moduleResults.values():
               moduleResult.createDom(self.dom,topElement)        
  @@ -204,6 +231,13 @@
           # Workspace dom is document, but stuff on first
           # element
           self.completeState(self.dom.documentElement)
  +                
  +        # Timing
  +        self.startDateTime=self.dom.documentElement.getAttribute('start')
  +        self.startDateTimeUtc=self.dom.documentElement.getAttribute('startUtc')
  +        self.endDateTime=self.dom.documentElement.getAttribute('end')
  +        self.endDateTimeUtc=self.dom.documentElement.getAttribute('endUtc')
  +        self.timezone=self.dom.documentElement.getAttribute('tzone')
           
           #
           # Import all modules
  
  
  
  1.13      +15 -0     gump/python/gump/model/server.py
  
  Index: server.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/server.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- server.py	16 Mar 2004 19:50:15 -0000	1.12
  +++ server.py	10 Apr 2004 23:09:29 -0000	1.13
  @@ -64,6 +64,21 @@
       def getUrl(self):
           return str(self.xml.url)
           
  +    def hasResultsUrl(self):
  +        return self.hasUrl()
  +        
  +    def getResultsUrl(self):
  +        return self.getUrl() + '/results.xml'
  +        
  +    def hasResults(self):
  +        return hasattr(self,'results') and self.results
  +    
  +    def setResults(self,results):
  +        self.results=results
  +        
  +    def getResults(self,results):
  +        return self.results
  +        
       def hasTitle(self): 
           return hasattr(self.xml,'title') and self.xml.title
           
  
  
  
  1.43      +45 -5     gump/python/gump/model/workspace.py
  
  Index: workspace.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/workspace.py,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- workspace.py	30 Mar 2004 19:20:38 -0000	1.42
  +++ workspace.py	10 Apr 2004 23:09:29 -0000	1.43
  @@ -74,20 +74,60 @@
           #
       	PropertyContainer.importProperties(self,self.xml)    	
                       
  -        #    
  -        self.startdatetime=time.strftime(setting.datetimeformat, \
  -                                time.localtime())
  -        self.timezone=str(time.tzname)    
  +        # Set times
  +        self.initializeTimes()
   
           # Where the merged XML was put
           self.mergeFile=None
           
           self.listener=ModelListener()
           
  +    def initializeTimes(self):
  +        # Store timezone
  +        self.timezone=str(time.tzname)    
  +                
  +        # :TODO: Ensure no clock ticks between these two,
  +        # i.e. make one.
  +        self.startDateTimeUtc=time.strftime(setting.datetimeformat, \
  +                                            time.gmtime())
  +        self.startDateTime=time.strftime(setting.datetimeformat, \
  +                                            time.localtime())
  +                                                    
  +        self.endDateTimeUtc=''
  +        self.endDateTime=''
  +        
  +    def setEndTime(self):
  +        
  +        # Don't do more than once.
  +        if self.endDateTimeUtc and self.endDateTime: return
  +            
  +        
  +        # :TODO: Ensure no clock ticks between these two,
  +        # i.e. make one.
  +        self.endDateTimeUtc=time.strftime(setting.datetimeformat, \
  +                                            time.gmtime())
  +        self.endDateTime=time.strftime(setting.datetimeformat, \
  +                                            time.localtime())
  +                                            
  +        
  +    def getTimezone(self):
  +        return self.timezone
  +        
  +    def getStartDateTime(self):
  +        return self.startDateTime
  +        
  +    def getStartDateTimeUtc(self):
  +        return self.startDateTimeUtc
  +        
  +    def getEndDateTime(self):
  +        return self.endDateTime
  +        
  +    def getStartDateTimeUtc(self):
  +        return self.endDateTimeUtc
  +        
       def getChildren(self):
           return self.getModules() 
       
  -
       # Repository Interface
       
       def hasRepository(self,rname):
  
  
  
  1.138     +96 -4     gump/python/gump/document/forrest.py
  
  Index: forrest.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/forrest.py,v
  retrieving revision 1.137
  retrieving revision 1.138
  diff -u -r1.137 -r1.138
  --- forrest.py	9 Apr 2004 22:38:25 -0000	1.137
  +++ forrest.py	10 Apr 2004 23:09:29 -0000	1.138
  @@ -329,7 +329,8 @@
           definitionTable.createEntry('Python', str(sys.version))
           definitionTable.createEntry('Operating System (Name)', str(os.name))
           definitionTable.createEntry('@@DATE@@', str(default.date))
  -        definitionTable.createEntry('Start Date/Time', workspace.startdatetime)
  +        definitionTable.createEntry('Start Date/Time (UTC)', workspace.getStartDateTimeUtc())
  +        definitionTable.createEntry('Start Date/Time', workspace.getStartDateTime())
           definitionTable.createEntry('Timezone', workspace.timezone)
   
           javaproperties=run.getEnvironment().getJavaProperties()
  @@ -451,7 +452,7 @@
               self.resolver.getFile(workspace,'servers'))
                   
           serversSection=document.createSection('All Servers')
  -        serversTable=serversSection.createTable(['Name'])
  +        serversTable=serversSection.createTable(['Name','Results','Start (Local)','Start
(UTC)','End (UTC)'])
   
           scount=0
           for server in sortedServerList:
  @@ -463,6 +464,24 @@
                          
               self.insertLink( server, workspace, serverRow.createData())
               
  +            if server.hasResultsUrl():
  +                serverRow.createData().createFork(	\
  +                            'Results',	\
  +                            server.getResultsUrl())
  +            else:
  +                serverRow.createData('Not Available')
  +                
  +            if server.hasResults():
  +                serverRow.createData(server.getResults().getStartDateTime() + ' ' + \
  +                                        server.getResults().getTimeZone())
  +                serverRow.createData(server.getResults().getStartDateTimeUtc())
  +                serverRow.createData(server.getResults().getEndDateTimeUtc())
  +            else:
  +                serverRow.createData('N/A')
  +                serverRow.createData('N/A')
  +                serverRow.createData('N/A')
  +        
  +                        
           if not scount: serversTable.createLine('None')
           
           document.serialize()
  @@ -576,6 +595,54 @@
           
           document.serialize()
              
  +        
  +        #
  +        # ----------------------------------------------------------------------
  +        #
  +        # diffsLog.xml -- Notes log
  +        #
  +        document=XDocDocument('Server Differences',	\
  +                self.resolver.getFile(workspace,'diffsLog'))  
  +                    
  +        diffsSection=document.createSection('Server Differences')
  +        diffsSection.createParagraph(
  +            """This page displays entities with different states on different servers.""")
  +            
  +        dcount=0
  +        for module in gumpSet.getModuleSequence():
  +            if not gumpSet.inModuleSequence(module): continue               
  +                                
  +            moduleSection=None
  +            if module.hasServerResults() and module.getServerResults().hasDifferences():
  +                moduleSection=document.createSection('Module : ' + module.getName())  
             
  +                # Link to the module
  +                self.insertLink(module,workspace,moduleSection.createParagraph()) 
  +            
  +                # Display the module server links
  +                self.documentServerLinks(moduleSection,module,workspace)   
  +                
  +            for project in module.getProjects():
  +                if not gumpSet.inProjectSequence(project): continue         
  +                if not project.hasServerResults(): continue
  +                if not project.getServerResults().hasDifferences(): continue
  +            
  +                if not moduleSection:				
  +                    moduleSection=document.createSection('Module : ' + module.getName())
  +
  +                projectSection=moduleSection.createSection('Project : ' + project.getName())
  +        
  +                # Link to the project
  +                self.insertLink(project,workspace,projectSection.createParagraph())   

  +            
  +                # Display the project server links
  +                self.documentServerLinks(projectSection,project,workspace)      
  +        
  +                dcount+=1
  +                
  +        if not dcount: diffsSection.createParagraph('None.')
  +        
  +        document.serialize()
  +           
           #
           # ----------------------------------------------------------------------
           #
  @@ -1069,6 +1136,26 @@
               if server.hasSite() and not server.getSite() == server.getUrl():
                   detailList.createEntry('Site: ').createFork(	\
                           server.getSite(), server.getSite())
  +                        
  +        if server.hasResults():
  +            # :TODO: Do a lot more ....
  +            if server.hasResultsUrl():
  +                detailList.createEntry('Results URL: ').createFork(	\
  +                        server.getResultsUrl(),server.getResultsUrl())    
  +                                                
  +                detailList.createEntry('Start Time: ',	\
  +                        server.getResults().getStartDateTime() + ' ' + \
  +                        server.getResults().getTimeZone())
  +                                                
  +                detailList.createEntry('End Time: ',	\
  +                        server.getResults().getEndDateTime() + ' ' + \
  +                        server.getResults().getTimeZone())
  +                        
  +                detailList.createEntry('Start Time (UTC): ',	\
  +                        server.getResults().getStartDateTimeUtc())
  +                detailList.createEntry('End Time (UTC): ',	\
  +                        server.getResults().getEndDateTimeUtc())
  +        
               
           self.documentXML(document,server)
           
  @@ -1682,10 +1769,12 @@
           
               # If we know state on the other server.
               statePair=None
  +            utcTime=None
               if serverResults and serverResults.has_key(server):
                   results=serverResults[server]
                   if results:
                       statePair=results.getStatePair()
  +                    utcTime=results.getStartDateTimeUtc()
                                   
               # If we can resolve this object to a URL, then do                        
               if server.hasResolver():
  @@ -1700,8 +1789,11 @@
                       xdocNode.createBreak()
                       # Insert the Icon...
                       depth=getDepthForObject(linkable)
  -                    self.insertStatePairIconAtDepth(dataNode,statePair,depth)         
      
  -                
  +                    self.insertStatePairIconAtDepth(dataNode,statePair,depth)      
  +                    
  +                if utcTime:
  +                    xdocNode.createBreak()    
  +                    xdocNode.createText('At ' + utcTime)                              
     
                           
       def documentProperties(self,xdocNode,propertyContainer,title='Properties'):
           
  
  
  
  1.15      +3 -3      gump/gumpy.py
  
  Index: gumpy.py
  ===================================================================
  RCS file: /home/cvs/gump/gumpy.py,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- gumpy.py	6 Apr 2004 19:24:00 -0000	1.14
  +++ gumpy.py	10 Apr 2004 23:09:29 -0000	1.15
  @@ -63,7 +63,7 @@
           
           #
           if not outputFile:
  -            outputFile='out.tmp'
  +            outputFile='out.txt'
           
           fullCommand = command + ' ' + args + ' >' + outputFile + ' 2>&1'    
           log.write('Execute : ' + fullCommand + '\n')
  @@ -156,7 +156,7 @@
   lock.close()
   
   # Enable a log
  -logFile=os.path.abspath('gumpy.log')
  +logFile=os.path.abspath('gumpy_log.txt')
   log=open(logFile,'w',0) # Unbuffered...
   
   result=0
  @@ -327,7 +327,7 @@
           # Cat log if failed...
           published=0
           if logdir:
  -            publishedLogFile=os.path.abspath(os.path.join(logdir,'gumpy.log'))
  +            publishedLogFile=os.path.abspath(os.path.join(logdir,'gumpy_log.txt'))
               try:
                   publishedLog=open(publishedLogFile,'w',0) # Unbuffered...
                   catFile(publishedLog, logFile, logTitle)    
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Mime
View raw message