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.13 by spiga, Fri Apr 4 15:52:16 2008 UTC vs.
Revision 1.17 by slacapra, Thu Apr 17 11:19:31 2008 UTC

# Line 80 | Line 80 | class DBinterface:
80          with the first coniguration stuff
81          """
82          opt={}
83 <        opt['serverName']=optsToSave['server_name']
84 <        opt[ 'name']=common.work_space.taskName()  
83 >        if optsToSave.get('server_mode',0) == 1: opt['serverName']=optsToSave['server_name']
84 >        opt['name']=common.work_space.taskName()  
85          task = Task( opt )
86          try:
87              common.bossSession.saveTask( task )
# Line 117 | Line 117 | class DBinterface:
117          for id in jobsL:
118              parameters = {}
119              parameters['jobId'] =  str(id)
120 <            parameters['name'] = 'job' + str(id)
120 >            parameters['name'] = task['name'] + '_' + 'job' + str(id)
121              job = Job(parameters)
122              jobs.append(job)  
123          task.addJobs(jobs)
# Line 173 | Line 173 | class DBinterface:
173          """
174           List a complete set of infos for a job/range of jobs  
175          """
176 <        task = self.getTask()
177 <
178 <        njobs = len(jobs)
179 <        lines=[]
180 <        header=''
181 <     #   ##query the DB asking the right infos for runningJobs  TODO  DS
182 <     #   for job in jobs:
183 <     #       ## here the query over runngJobs  
184 <     #       pass
185 <
176 >        task = self.getTask(jobs)
177  
178 <     #   ##Define Header to show and Pass the query results,
179 <     #   ##  header and format to displayReport()   TODO  DS
180 <     #   if njobs == 1: plural = ''
181 <     #   else:          plural = 's'
182 <     #   header += 'Listing %d job%s:\n' % (njobs, plural)
183 <     #   header += ' :\n' % (---) ## TODO DS
184 <
185 <     #   displayReport(header, lines):
178 >        Jobs = task.getJobs()
179 >        print "--------------------------"
180 >        for Job in Jobs:
181 >            print "Id: ",Job['id']
182 >            print "Dest: ", Job['dlsDestination']
183 >            print "Output: ", Job['outputFiles']
184 >            print "Args: ",Job['arguments']
185 >            print "--------------------------"
186          return      
187  
188      def serializeTask(self, tmp_task = None):
# Line 305 | Line 296 | class DBinterface:
296          for i in task:
297              matched.append(i[field])
298          return matched
299 +
300 +    def deserXmlStatus(self, reportList):
301 +
302 +        task = self.getTask()
303 +
304 +        for job in task.jobs:
305 +            if not job.runningJob:
306 +                raise CrabException( "Missing running object for job %s"%str(job['id']) )
307 +
308 +            id = str(job.runningJob['id'])
309 +            # TODO linear search, probably it can be optized with binary search
310 +            rForJ = None
311 +            for r in reportList:
312 +                if r.getAttribute('id') in [ id, 'all']:
313 +                    rForJ = r
314 +                    break
315 +
316 +            # Data alignment
317 +            jobStatus = str(job.runningJob['statusScheduler'])
318 +            if rForJ.getAttribute('status') not in ['Created', 'Submitting']:
319 +                job.runningJob['statusScheduler'] = str( rForJ.getAttribute('status') )
320 +                jobStatus = str(job.runningJob['statusScheduler'])
321 +                job.runningJob['status'] = str( rForJ.getAttribute('sched_status') )
322 +
323 +            job.runningJob['destination'] = str( rForJ.getAttribute('site') )
324 +            dest = str(job.runningJob['destination']).split(':')[0]
325 +
326 +            job.runningJob['applicationReturnCode'] = str( rForJ.getAttribute('exe_exit') )
327 +            exe_exit_code = str(job.runningJob['applicationReturnCode'])
328 +
329 +            job.runningJob['wrapperReturnCode'] = str( rForJ.getAttribute('job_exit') )
330 +            job_exit_code = str(job.runningJob['wrapperReturnCode'])
331 +
332 +            if str( rForJ.getAttribute('resubmit') ).isdigit():
333 +                job['submissionNumber'] = int(rForJ.getAttribute('resubmit'))
334 +            # TODO cleared='0' field, how should it be handled/mapped in BL? #Fabio
335 +
336 +        common.bossSession.updateDB( task )
337 +
338 +        return

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines