Ignore:
Timestamp:
Aug 28, 2006, 1:20:02 PM (18 years ago)
Author:
garonne
Message:

improve tbroadcast script

File:
1 edited

Legend:

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

    r239 r240  
    4949    def instanciate_packages(self):
    5050        # We create the schedule of the work units
    51         print '# First, we initialize the DAG by parsing cmt show uses (takes a certain time... huk should be improved asap) '
     51        print '# First, we initialize the DAG by parsing cmt show uses'
    5252        cmd = 'cmt show uses'
    5353        status, output = commands.getstatusoutput (cmd)
     
    117117                        sys.exit(-1)
    118118                    self.packages[result[0]]['path'] = full_path
    119         print '# really takes a certain time ... '
     119        print '# Sometimes takes a certain time (should be improved asap)'
    120120
    121121    def get_current_package(self):   
     
    198198        packages = self.get_next_work_units()
    199199        if len(packages) !=0:
    200             print '\n# Execute parallel actions within ', packages                     
     200            print '\n#--------------------------------------------------------------'   
     201            print '# Execute parallel actions within packages', packages                     
    201202            for package in packages:
    202203                self.add_work_unit (package, command)
     
    218219    # the work the threads will have to do
    219220    def do_execute(self, arg):
    220         path = self.get_work_area_path (arg['package'])   
    221         self.set_work_unit_status (arg['package'], 'running')     
    222         cmd = "cmt -use="+ arg['package'] + " run '"+ arg['cmd'] + "'"
    223         os.chdir(path)       
    224         print '#--------------------------------------------------------------'
    225         print '# Now trying ['+ arg['cmd']+'] in ' + path
    226         print '#--------------------------------------------------------------'
    227         cmd = arg['cmd']
    228         status, output, error, pythonError  = exeCommand(cmd,  iTimeout = 10)     
    229         self.suppress_work_unit (arg['package'])
    230         self.set_work_unit_status (arg['package'], 'done')
    231         # status, output= commands.getstatusoutput(cmd)
    232         #print output
    233         #if status != 0:
    234         #   raise RuntimeError(output)
    235         return {'output':output, 'cmd': arg['cmd'], 'package':arg['package']}
     221      path = self.get_work_area_path (arg['package'])
     222      if path == None:
     223          raise RuntimeError('Path to package '+ arg['package'] +' not found')
     224      self.set_work_unit_status (arg['package'], 'running')     
     225      cmd = "cmt -use="+ arg['package'] + " run '"+ arg['cmd'] + "'"
     226      os.chdir(path)       
     227      print '#--------------------------------------------------------------'
     228      print '# Now trying ['+ arg['cmd']+'] in ' + path
     229      print '#--------------------------------------------------------------'
     230      cmd = arg['cmd']
     231      status, output, error, pythonError  = exeCommand(cmd,  iTimeout = 10)     
     232      self.suppress_work_unit (arg['package'])
     233      self.set_work_unit_status (arg['package'], 'done')
     234      # status, output= commands.getstatusoutput(cmd)
     235      #if status != 0:
     236      #   raise RuntimeError(output)
     237      return {'output':output, 'cmd': arg['cmd'], 'package':arg['package']}
    236238             
    237239    # this will be called when an exception occurs within a thread
    238240    def handle_exception(self, request, exc_info):
    239241        #traceback.print_stack()
    240         print "# Exception occured in request #%s: %s" % \
    241           (request.requestID, exc_info[1])
     242      print '#--------------------------------------------------------------'       
     243      #print "# Exception occured in request #%s: %s" %(request.requestID, exc_info[1])
     244      print "# Exception occured: %s" %(exc_info[1])
     245      print '#--------------------------------------------------------------'   
     246      sys.exit(-1)
    242247#--------- EoF --------#   
Note: See TracChangeset for help on using the changeset viewer.