Changeset 237 for tbroadcast


Ignore:
Timestamp:
Aug 26, 2006, 2:15:12 PM (18 years ago)
Author:
garonne
Message:

corrige initialisation

Location:
tbroadcast/v2
Files:
2 edited

Legend:

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

    r236 r237  
    2929    def instanciate_packages(self):
    3030        # We create the schedule of the work units
     31        print '# first, we initialize the DAG (takes a long time... huk should be improved asap) '
    3132        cmd = 'cmt show uses'
    3233        status, output = commands.getstatusoutput (cmd)
     
    3738        current_package = self.get_current_package()
    3839        self.packages [current_package] = {'version': '*', 'dependencies': list(), 'status': 'waiting', 'path':os.getcwd()}
     40        indice  = 1
    3941        for line in lines:
    4042            if line [0] == '#' and line[:5] != "#CMT>" and line not in ['# Selection :','#']:
     
    4345                if name not in self.packages[current_package]['dependencies']:
    4446                   self.packages[current_package]['dependencies'].append (name)               
     47                   print '\n#', indice,':: add package', name
     48                   indice = indice + 1
    4549                if not self.packages.has_key (name):
    46                    self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path':self.get_package_path(name)}               
    47                 found = False
    48                 for ligne in lines:
     50                   self.packages [name] = {'version': version, 'dependencies': list(), 'status': 'waiting', 'path': None}               
     51                   found = False
     52                   for ligne in lines:
    4953                    if ligne [0] == '#' and ligne[:5] != "#CMT>" and ligne not in ['# Selection :','#']:               
    5054                       if found:
     
    5256                               if string.split (ligne)[2] not in self.packages[name]['dependencies']:
    5357                                   self.packages[name]['dependencies'].append (string.split (ligne)[2])
     58                                   print "# add dependency", string.split (ligne)[2], ' to package ',name
    5459                           else:
    5560                                found = False                                                                                                   
     
    5762                           level = string.find(ligne, 'use')
    5863                           found = True   
     64            if line[:4] == "use ":             
     65                result  = string.split (line[4:len(line)], ' ')
     66                if  self.packages.has_key(result[0]):
     67                    if len(result)==4:
     68                        name, version, offset, path = string.split (line[4:len(line)], " ")
     69                        if os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'):
     70                            full_path = path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'
     71                        elif os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/cmt'):   
     72                            full_path = path[1:-1] + '/' + offset + '/' +name + '/cmt'
     73                        else:
     74                            print '# error path not found for', name
     75                            sys.exit(-1)   
     76                    elif len(result)==5:
     77                        name, version, offset, path, importation = string.split (line[4:len(line)], " ")                                       
     78                        if os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'):
     79                            full_path = path[1:-1] + '/' + offset + '/' +name + '/' + version + '/cmt'
     80                        elif os.path.exists(path[1:-1] + '/' + offset + '/' +name + '/cmt'):   
     81                            full_path = path[1:-1] + '/' + offset + '/' +name + '/cmt'
     82                        else:
     83                            print '# error path not found for', name
     84                            sys.exit(-1)                                                                                                   
     85                    elif len(result)==3:
     86                        name, version, path = string.split (line[4:len(line)], " ")
     87                        if os.path.exists(path[1:-1] + '/' +name + '/' + version + '/cmt'):
     88                            full_path = path[1:-1] + '/' +name + '/' + version + '/cmt'
     89                        elif os.path.exists(path[1:-1] + '/' +name + + '/cmt'):   
     90                            full_path = path[1:-1] + '/' +name + + '/cmt'
     91                        else:
     92                            print '# error path not found for', name
     93                            sys.exit(-1)
     94                    else:
     95                        print "error:",line
     96                        print str(result)
     97                        sys.exit(-1)
     98                    self.packages[result[0]]['path'] = full_path
     99        print '# really takes a long time... '
    59100
    60101    def get_current_package(self):   
     
    75116       
    76117    def get_package_path (self, name):   
     118        #return os.getcwd ()
    77119        cmd = 'cmt -use='+name+' run pwd'
    78120        status, output = commands.getstatusoutput (cmd)
     
    82124        lines = string.split(output, '\n')
    83125        for line in lines:
    84             if line [0] != '#':
     126            if line [0] != '#' and line[:5] != "#CMT>":
     127                print line
    85128                return line
    86129 
  • tbroadcast/v2/scripts/tbroadcast

    r236 r237  
    2727                     
    2828    # we create a pool of num_worker worker threads
    29     print 'num_worker', num_worker , command
     29    #print 'num_worker', num_worker , command
    3030    master = Scheduler (num_workers=num_worker)       
    3131    master.execute_all (command)
Note: See TracChangeset for help on using the changeset viewer.