119 |
|
parameters['jobId'] = str(id) |
120 |
|
parameters['name'] = task['name'] + '_' + 'job' + str(id) |
121 |
|
job = Job(parameters) |
122 |
< |
jobs.append(job) |
122 |
> |
jobs.append(job) |
123 |
> |
common.bossSession.getRunningInstance(job) |
124 |
> |
job.runningJob['status'] = 'C' |
125 |
|
task.addJobs(jobs) |
126 |
|
try: |
127 |
|
common.bossSession.updateDB( task ) |
175 |
|
""" |
176 |
|
List a complete set of infos for a job/range of jobs |
177 |
|
""" |
178 |
< |
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 |
< |
|
178 |
> |
task = self.getTask(jobs) |
179 |
|
|
180 |
< |
# ##Define Header to show and Pass the query results, |
181 |
< |
# ## header and format to displayReport() TODO DS |
182 |
< |
# if njobs == 1: plural = '' |
183 |
< |
# else: plural = 's' |
184 |
< |
# header += 'Listing %d job%s:\n' % (njobs, plural) |
185 |
< |
# header += ' :\n' % (---) ## TODO DS |
186 |
< |
|
187 |
< |
# displayReport(header, lines): |
180 |
> |
Jobs = task.getJobs() |
181 |
> |
print "--------------------------" |
182 |
> |
for Job in Jobs: |
183 |
> |
print "Id: ",Job['id'] |
184 |
> |
print "Dest: ", Job['dlsDestination'] |
185 |
> |
print "Output: ", Job['outputFiles'] |
186 |
> |
print "Args: ",Job['arguments'] |
187 |
> |
print "--------------------------" |
188 |
|
return |
189 |
|
|
190 |
|
def serializeTask(self, tmp_task = None): |
227 |
|
lines=[] |
228 |
|
task = self.getTask(jobsL) |
229 |
|
for job in task.jobs: |
230 |
< |
lines.append(eval(job[attr])) |
230 |
> |
lines.append(job[attr]) |
231 |
|
return lines |
232 |
|
|
233 |
|
def queryRunJob(self, attr, jobsL): |
253 |
|
common.logger.debug(3, "Error loading Jobs By distinct Attr : " +str(traceback.format_exc())) |
254 |
|
raise CrabException('Error loading Jobs By distinct Attr '+str(e)) |
255 |
|
|
256 |
< |
for i in task: distAttr.append(eval(i[attr])) |
256 |
> |
for i in task: distAttr.append(i[attr]) |
257 |
|
return distAttr |
258 |
|
|
259 |
|
def queryDistJob_Attr(self, attr_1, attr_2, list): |
267 |
|
common.logger.debug(3, "Error loading Jobs By distinct Attr : " +str(traceback.format_exc())) |
268 |
|
raise CrabException('Error loading Jobs By distinct Attr '+str(e)) |
269 |
|
|
270 |
< |
for i in task: distAttr.append(eval(i[attr_1])) |
270 |
> |
for i in task: distAttr.append(i[attr_1]) |
271 |
|
return distAttr |
272 |
|
|
273 |
|
def queryAttrJob(self, attr, field): |
296 |
|
common.logger.debug(3, "Error loading Jobs By Running Attr : " +str(traceback.format_exc())) |
297 |
|
raise CrabException('Error loading Jobs By Running Attr '+str(e)) |
298 |
|
for i in task: |
299 |
< |
matched.append(i[field]) |
299 |
> |
matched.append(i.runningJob[field]) |
300 |
|
return matched |
301 |
+ |
|
302 |
+ |
def deserXmlStatus(self, reportList): |
303 |
+ |
|
304 |
+ |
task = self.getTask() |
305 |
+ |
|
306 |
+ |
for job in task.jobs: |
307 |
+ |
if not job.runningJob: |
308 |
+ |
raise CrabException( "Missing running object for job %s"%str(job['id']) ) |
309 |
+ |
|
310 |
+ |
id = str(job.runningJob['id']) |
311 |
+ |
# TODO linear search, probably it can be optized with binary search |
312 |
+ |
rForJ = None |
313 |
+ |
for r in reportList: |
314 |
+ |
if r.getAttribute('id') in [ id, 'all']: |
315 |
+ |
rForJ = r |
316 |
+ |
break |
317 |
+ |
|
318 |
+ |
# Data alignment |
319 |
+ |
jobStatus = str(job.runningJob['statusScheduler']) |
320 |
+ |
if rForJ.getAttribute('status') not in ['Created', 'Submitting'] and \ |
321 |
+ |
job.runningJob['statusScheduler'] != 'Cleared': |
322 |
+ |
job.runningJob['statusScheduler'] = str( rForJ.getAttribute('status') ) |
323 |
+ |
jobStatus = str(job.runningJob['statusScheduler']) |
324 |
+ |
job.runningJob['status'] = str( rForJ.getAttribute('sched_status') ) |
325 |
+ |
|
326 |
+ |
job.runningJob['destination'] = str( rForJ.getAttribute('site') ) |
327 |
+ |
dest = str(job.runningJob['destination']).split(':')[0] |
328 |
+ |
|
329 |
+ |
job.runningJob['applicationReturnCode'] = str( rForJ.getAttribute('exe_exit') ) |
330 |
+ |
exe_exit_code = str(job.runningJob['applicationReturnCode']) |
331 |
+ |
|
332 |
+ |
job.runningJob['wrapperReturnCode'] = str( rForJ.getAttribute('job_exit') ) |
333 |
+ |
job_exit_code = str(job.runningJob['wrapperReturnCode']) |
334 |
+ |
|
335 |
+ |
if str( rForJ.getAttribute('resubmit') ).isdigit(): |
336 |
+ |
job['submissionNumber'] = int(rForJ.getAttribute('resubmit')) |
337 |
+ |
# TODO cleared='0' field, how should it be handled/mapped in BL? #Fabio |
338 |
+ |
|
339 |
+ |
common.bossSession.updateDB( task ) |
340 |
+ |
|
341 |
+ |
return |