Changeset 393 for tbroadcast


Ignore:
Timestamp:
Mar 22, 2007, 5:57:11 PM (17 years ago)
Author:
garonne
Message:

See C.L 1

Location:
tbroadcast/HEAD
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tbroadcast/HEAD/python/tbroadcast.py

    r316 r393  
    1515import commands
    1616import traceback
     17import exceptions
    1718from threading import BoundedSemaphore
    1819
     
    2627class Scheduler:
    2728
    28     def __init__(self, num_workers=20, file=None, ignore_cycles=False, local=False, output=None, error=None, silent = False, perf=False):
     29    def __init__(self, num_workers=20, file=None, ignore_cycles=False, local=False, output=None, error=None, silent = False, perf=False, keep_going=True):
    2930        self.pool            = ThreadPool(num_workers=num_workers)
    3031        self.current_package = self.get_current_package()
     
    3940        self.silent          = silent
    4041        self.perf            = perf
     42        self.keep_going      = keep_going
    4143        if self.perf is not False:
    4244            f = open (self.perf, 'w+')
     
    450452      self.packages[arg['package']] ['startTime'] = time.time ()                           
    451453      status, output, error, pythonError  = exeCommand(sCmd=cmd, oLineCallback=self.redirectOutput, arg=arg)#,iTimeout = 3600)
     454      if not self.keep_going and status > 0:
     455        sys.exit(status)   
     456                     
    452457      self.packages[arg['package']] ['endTime'] = time.time ()
    453458      if self.perf:
     
    488493      print '#--------------------------------------------------------------'       
    489494      #print "# Exception occured in request #%s: %s" %(request.requestID, exc_info[1])
    490       print "# Exception occured: %s" %(exc_info[1])
     495      if exc_info[0]== exceptions.SystemExit:
     496        print "Stop execution (No_keep_going option enabled): exit code == %s " %(exc_info[1]) 
     497        print '#--------------------------------------------------------------'   
     498        sys.exit(exc_info[1])
     499      print "# Exception occured: %s" %(exc_info[1])     
    491500      print exc_info
    492501      print '#--------------------------------------------------------------'   
  • tbroadcast/HEAD/scripts/tbroadcast

    r309 r393  
    2424    print '#   -global               : Reach packages in all CMTPATH/CMTPROJECTPATH items'   
    2525    print '#   -ignore_cycles        : Suppress automatically the cycles'
    26     print '#   -make=<file>          : Generate a recursive Make, see: http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html'
     26    print '#   -make=<file>          : Generate a recursive Make, [see: http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html]'
    2727    print '#   -nb=<num_worker>      : Change the total number of threads[default is 20]'
     28    print '#   -no_keep_going        : Exit after the first exit code > 1 found and return it in the shell'
    2829    print '#   -output=<location>    : Output directory to store output files with the form <package>_output.log'
    2930    print '#   -error=<location>     : Output directory to store error output with the form <package>_error.log'
     
    3839    num_worker    = 20
    3940    command       = ''
    40     version       = 'v2.0.3'
     41    version       = 'HEAD'
    4142    test          = False
    4243    check         = False
     
    5152    make          = None
    5253    makefile      = 'Makefile'
     54    keep_going    = True
    5355   
    5456    if len(sys.argv) == 1:
     
    7678                     ignore_cycles = True
    7779                 if option == '-silent':             
    78                      silent = True                 
     80                     silent = True       
     81                 if option == '-no_keep_going':             
     82                     keep_going = False
     83                             
    7984                 if option == '-help':   
    8085                      usage()
     
    9398                  command = arg
    9499
    95     master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles, local=local, output=output, error=error, silent=silent, perf=perf)
     100    master = Scheduler (num_workers=num_worker, file=file, ignore_cycles=ignore_cycles,
     101                        local=local, output=output, error=error, silent=silent, perf=perf,
     102                        keep_going=keep_going)
    96103    if test:
    97104        master.simulate_execution()
     
    104111    else:
    105112        master.execute_all (command)
    106     sys.exit(-1);
     113    #sys.exit(-1);
    107114#--------- EoF --------#
Note: See TracChangeset for help on using the changeset viewer.