ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/DBinterface.py
(Generate patch)

Comparing COMP/CRAB/python/DBinterface.py (file contents):
Revision 1.58 by mcinquil, Tue Apr 28 12:54:19 2009 UTC vs.
Revision 1.62 by spiga, Fri Jun 12 09:38:54 2009 UTC

# Line 1 | Line 1
1 from crab_logger import Logger
1   from crab_exceptions import *
2   from crab_util import *
3   import common
# Line 58 | Line 57 | class DBinterface:
57          try:
58              task = common.bossSession.load(1,jobsList)
59          except Exception, e :
60 <            common.logger.debug(3, "Error while getting task : " +str(traceback.format_exc()))
60 >            common.logger.debug( "Error while getting task : " +str(traceback.format_exc()))
61              raise CrabException('Error while getting task '+str(e))
62          return task
63  
# Line 69 | Line 68 | class DBinterface:
68          try:
69              task = common.bossSession.load(1,str(n))
70          except Exception, e :
71 <            common.logger.debug(3, "Error while getting job : " +str(traceback.format_exc()))
71 >            common.logger.debug( "Error while getting job : " +str(traceback.format_exc()))
72              raise CrabException('Error while getting job '+str(e))
73          return task
74  
# Line 86 | Line 85 | class DBinterface:
85          try:
86              common.bossSession.saveTask( task )
87          except Exception, e :
89           # common.logger.debug(3, "Error creating task : " +str(traceback.format_exc()))
90           # raise CrabException('Error creating task '+str(e))
88              raise CrabException('Error creating task '+str(traceback.format_exc()))
89              
90          return
# Line 209 | Line 206 | class DBinterface:
206          if server_mode == 1:
207              # init client server params...
208              CliServerParams(self)      
209 <            headerTask= "Task Id = %-40s " %(task['name'])
209 >            headerTask = "Task Id = %-40s\n" %(task['name'])
210 >            headerTask+=  '--------------------------------------------------------------------------------------------\n'
211              displayReport(self,headerTask,lines)
212 <            common.logger.message(showWebMon(self.server_name))
212 >            common.logger.info(showWebMon(self.server_name))
213          if (jid ) or (server_mode == 0):
214              for job in task.jobs:
215                  toPrint=''
216                  common.bossSession.getRunningInstance(job)
217                  toPrint = "%-5s %-50s " % (job['jobId'],job.runningJob['schedulerId'])
218                  lines.append(toPrint)
219 <            header+= "%-5s %-50s " % ('Job:','ID' )
219 >            header+= "%-5s %-50s\n " % ('Job:','ID' )
220 >            header+=  '--------------------------------------------------------------------------------------------\n'
221              displayReport(self,header,lines)
222          return  
223  
# Line 260 | Line 259 | class DBinterface:
259          try:
260              task = common.bossSession.loadJobDist( 1, attr )
261          except Exception, e :
262 <            common.logger.debug(3, "Error loading Jobs By distinct Attr : " +str(traceback.format_exc()))
262 >            common.logger.debug( "Error loading Jobs By distinct Attr : " +str(traceback.format_exc()))
263              raise CrabException('Error loading Jobs By distinct Attr '+str(e))
264  
265          for i in task: distAttr.append(i[attr])  
# Line 274 | Line 273 | class DBinterface:
273          try:
274              task = common.bossSession.loadJobDistAttr( 1, attr_1, attr_2, list )
275          except Exception, e :
276 <            common.logger.debug(3, "Error loading Jobs By distinct Attr : " +str(traceback.format_exc()))
276 >            common.logger.debug( "Error loading Jobs By distinct Attr : " +str(traceback.format_exc()))
277              raise CrabException('Error loading Jobs By distinct Attr '+str(e))
278  
279          for i in task: distAttr.append(i[attr_1])  
# Line 288 | Line 287 | class DBinterface:
287          try:
288              task = common.bossSession.loadJobsByAttr(attr )
289          except Exception, e :
290 <            common.logger.debug(3, "Error loading Jobs By Attr : " +str(traceback.format_exc()))
290 >            common.logger.debug( "Error loading Jobs By Attr : " +str(traceback.format_exc()))
291              raise CrabException('Error loading Jobs By Attr '+str(e))
292          for i in task:
293              matched.append(i[field])
# Line 303 | Line 302 | class DBinterface:
302          try:
303              task = common.bossSession.loadJobsByRunningAttr(attr)
304          except Exception, e :
305 <            common.logger.debug(3, "Error loading Jobs By Running Attr : " +str(traceback.format_exc()))
305 >            common.logger.debug( "Error loading Jobs By Running Attr : " +str(traceback.format_exc()))
306              raise CrabException('Error loading Jobs By Running Attr '+str(e))
307          for i in task:
308              matched.append(i.runningJob[field])
# Line 319 | Line 318 | class DBinterface:
318              common.bossSession.getNewRunningInstance(job)
319              job.runningJob['status'] = 'C'
320              job.runningJob['statusScheduler'] = 'Created'
321 +            job.runningJob['state'] = 'Created'
322          common.bossSession.updateDB(task)    
323          return        
324  
# Line 356 | Line 356 | class DBinterface:
356              # Data alignment
357              if rForJ.getAttribute('status') not in ['Created', 'Unknown']:
358                     # update the status  
359 <                common.logger.debug(3,"Updating DB status for job: " + str(id) + " @: " \
359 >                common.logger.debug("Updating DB status for job: " + str(id) + " @: " \
360                                        + str(rForJ.getAttribute('status')) )
361                  job.runningJob['statusScheduler'] = str( rForJ.getAttribute('status') )
362                  if (rForJ.getAttribute('status') == 'Done' or rForJ.getAttribute('status') == 'Done (Failed)')\
# Line 376 | Line 376 | class DBinterface:
376                  job.runningJob['wrapperReturnCode'] = str( rForJ.getAttribute('job_exit') )
377                  job_exit_code = str(job.runningJob['wrapperReturnCode'])
378  
379 <                ## unsing 'standardInput' field for 'ended' tag ['Y','N']
380 <                job['standardInput'] = str( rForJ.getAttribute('ended') )
379 >                job['closed'] = str( rForJ.getAttribute('ended') )
380  
381                  job.runningJob['state'] = str( rForJ.getAttribute('action') )
382            
# Line 393 | Line 392 | class DBinterface:
392      # FIXME temporary method to verify what kind of submission to perform towards the server
393      def checkIfNeverSubmittedBefore(self):
394          for j in self.getTask().jobs:
395 <            if j.runningJob['submission'] > 1 or j.runningJob['status'] != 'C' or \
397 <                    j.runningJob['statusScheduler'] != 'Created':
395 >            if j.runningJob['submission'] > 1 or j.runningJob['state'] != 'Created':
396                  return False
397          return True
398  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines