Changeset 245
- Timestamp:
- Sep 8, 2006, 11:39:11 AM (18 years ago)
- Location:
- tbroadcast/v2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tbroadcast/v2/python/tbroadcast.py
r244 r245 26 26 class Scheduler: 27 27 28 def __init__(self, num_workers=20, file=None, ignore_cycles=False, local=False, output=None, error=None, silent = False ):28 def __init__(self, num_workers=20, file=None, ignore_cycles=False, local=False, output=None, error=None, silent = False, perf=False): 29 29 self.pool = ThreadPool(num_workers=num_workers) 30 30 self.current_package = self.get_current_package() … … 38 38 self.error = error 39 39 self.silent = silent 40 self.perf = perf 41 if self.perf: 42 f = open ('performances.log', 'w+') 43 f.close() 40 44 if output is not None: 41 45 if not os.path.exists (output): … … 410 414 #print "**Result: %s from request #%s" % (str(result), request.requestID) 411 415 #print "# Result: %s from request #%s" % (result['package'], request.requestID) 412 self.execute (result['cmd']) 416 #if result['package'] == 'CodeCheck': 417 # sys.exit(-1) 418 self.execute (result['cmd']) 413 419 414 420 # the work the threads will have to do 415 421 def do_execute(self, arg): 416 422 path = self.get_work_area_path (arg['package']) 417 if path == None :423 if path == None or not os.path.exists(path): 418 424 raise RuntimeError('Path to package '+ arg['package'] +' not found') 419 425 self.set_work_unit_status (arg['package'], 'running') 420 cmd = "cmt -use="+ arg['package'] + " run '"+ arg['cmd'] + "'" 421 os.chdir(path) 426 #cmd = "cmt -use="+ arg['package'] + " run '"+ arg['cmd'] + "'" 427 #os.chdir(path) 428 #arg['cmd'] = "cd "+ path +";"+ arg['cmd'] 422 429 print '#--------------------------------------------------------------' 423 430 print '# ('+str(self.get_counter())+'/'+str(len(self.packages))+') Now trying ['+ arg['cmd']+'] in ' + path 424 431 print '#--------------------------------------------------------------' 425 cmd = arg['cmd']432 cmd = "cd "+ path +";"+ arg['cmd'] 426 433 #status, output= commands.getstatusoutput(cmd) 427 434 # init output file … … 431 438 if self.error is not None: 432 439 f = open (self.error+'/'+arg['package']+'_error.log', 'w+') 433 f.close() 440 f.close() 441 self.packages[arg['package']] ['startTime'] = time.time () 434 442 status, output, error, pythonError = exeCommand(sCmd=cmd, oLineCallback=self.redirectOutput, arg=arg)#,iTimeout = 3600) 443 self.packages[arg['package']] ['endTime'] = time.time () 444 if self.perf: 445 self.semaphore.acquire () 446 f = open ('performances.log', 'a') 447 f.write (arg['package']+" "+str(self.packages[arg['package']] ['startTime'])+" "+str(self.packages[arg['package']] ['endTime'] )+'\n') 448 f.close() 449 self.semaphore.release() 435 450 self.suppress_work_unit (arg['package']) 436 451 self.set_work_unit_status (arg['package'], 'done') … … 465 480 #print "# Exception occured in request #%s: %s" %(request.requestID, exc_info[1]) 466 481 print "# Exception occured: %s" %(exc_info[1]) 482 print exc_info 467 483 print '#--------------------------------------------------------------' 468 sys.exit(-1) 469 484 #sys.exit(-1) 470 485 471 486 #--------- EoF --------# -
tbroadcast/v2/scripts/tbroadcast
r244 r245 40 40 ignore_cycles = False 41 41 silent = False 42 perf = False 42 43 output = None 43 44 error = None … … 50 51 if option == '-f': 51 52 file = string.split(arg,'=')[1] 53 if option == '-perf': 54 perf = True 52 55 if option == '-output': 53 56 output = string.split(arg,'=')[1] … … 59 62 ignore_cycles = True 60 63 if option == '-silent': 61 silent = True 62 64 silent = True 63 65 if option == '-help': 64 66 usage() … … 74 76 command = arg 75 77 76 master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output, error=error, silent=silent )78 master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output, error=error, silent=silent, perf=perf) 77 79 if test: 78 80 master.simulate_execution()
Note: See TracChangeset
for help on using the changeset viewer.