Show
Ignore:
Timestamp:
07/02/09 13:17:06 (9 months ago)
Author:
wtang
Message:

change 'location' attribute from string to list, corresponding to the change of new cqm

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/Components/qsim.py

    r1599 r1600  
    146146    end_time: unix second, float 
    147147    failure_time: unix second, float 
    148     location: 'partition:partition', string 
     148    location: list of string(partition name) 
    149149    state: ['invisible', 'running', 'queued', 'ended', 'pending']  string 
    150150    is_visible: true/false 
     
    201201        self.recovery_opt = spec.get("recovery_opt", RECOVERYOPT) 
    202202        self.checkpoint = 1 
    203         self.location = '' 
     203        self.location = [] 
    204204 
    205205class JobList(DataList): 
     
    332332         
    333333        #initialize time stamps and job queues 
    334         #time stamp format: ('EVENT', 'time_stamp_date', time_stamp_second, {'job_id':str(jobid), 'location':'partition-name'}) 
     334        #time stamp format: ('EVENT', 'time_stamp_date', time_stamp_second, {'job_id':str(jobid), 'location':[partition1, partition2,...]}) 
    335335        self.time_stamps = [('I', '0', 0, {})] 
    336336        self.cur_time_index = 0 
     
    536536            message = "%s;Q;%d;queue=%s" % (timestamp, spec['jobid'], spec['queue']) 
    537537        elif eventtype == 'R':  #resume running after failure recovery 
    538             message = "%s;R;%s" % (timestamp, spec['location']) 
     538            message = "%s;R;%s" % (timestamp, ":".join(spec['location'])) 
    539539        else: 
    540540            wall_time = spec['walltime'] 
     
    545545                message = "%s;S;%d;queue=%s qtime=%s Resource_List.ncpus=%s Resource_List.walltime=%s start=%s exec_host=%s" % \ 
    546546                (timestamp, spec['jobid'], spec['queue'], spec['submittime'],  
    547                  spec['nodes'], log_walltime, spec['start_time'], spec['location']) 
     547                 spec['nodes'], log_walltime, spec['start_time'], ":".join(spec['location'])) 
    548548            elif eventtype == 'E':  #end 
    549549                message = "%s;E;%d;queue=%s qtime=%s Resource_List.ncpus=%s Resource_List.walltime=%s start=%s end=%f exec_host=%s runtime=%s" % \ 
    550550                (timestamp, spec['jobid'], spec['queue'], spec['submittime'], spec['nodes'], log_walltime, spec['start_time'],  
    551                  round(float(spec['end_time']), 1), spec['location'],  
     551                 round(float(spec['end_time']), 1), ":".join(spec['location']), 
    552552                 spec['runtime']) 
    553553            elif eventtype == 'F':  #failure 
     
    555555                message = "%s;F;%d;queue=%s qtime=%s Resource_List.ncpus=%s Resource_List.walltime=%s exec_host=%s start=%s frag_runtime=%s complete=%f" % \ 
    556556                (timestamp, spec['jobid'], spec['queue'], spec['submittime'],  
    557                  spec['nodes'], log_walltime, spec['location'], spec['start_time'],  
     557                 spec['nodes'], log_walltime, ":".join(spec['location']), spec['start_time'],  
    558558                 frag_runtime, round(frag_runtime / float(spec['runtime']), 2) 
    559559                ) 
     
    561561                message = "%s;P;%d;queue=%s qtime=%s Resource_List.ncpus=%s Resource_List.walltime=%s exec_host=%s start=%s" % \ 
    562562                (timestamp, spec['jobid'], spec['queue'], spec['submittime'],  
    563                  spec['nodes'], log_walltime, spec['location'], spec['start_time'],  
     563                 spec['nodes'], log_walltime, ":".join(spec['location']), spec['start_time'],  
    564564                ) 
    565565                print "message=", message 
     
    595595             
    596596            #release partition immediately 
    597             partitions = jobspec['location'].split(':') 
     597            partitions = jobspec['location'] 
    598598            for partition in partitions: 
    599599                self.release_partition(partition) 
     
    613613   
    614614            #release partition 
    615             partitions = jobspec['location'].split(':') 
     615            partitions = jobspec['location'] 
    616616            for partition in partitions: 
    617617                print "partition %s start repairing" % (partition) 
     
    625625            failure_datetime = sec_to_date(fail) 
    626626            self.log_job_event('F', failure_datetime, jobspec) 
    627             print self.get_current_time(), " job %d failed at %s!!" % (job_id, jobspec['location']) 
     627            print self.get_current_time(), " job %d failed at %s!!" % (job_id, ":".join(jobspec['location'])) 
    628628             
    629629            rec_updates = self.recovery_mgr(jobspec) 
     
    714714        '''update the job state and start_time and end_time when cqadm --run 
    715715        is issued to a group of jobs''' 
    716         partitions = updates['location'].split(':') 
     716        partitions = updates['location'] 
    717717        for partition in partitions: 
    718718            self.reserve_partition(partition) 
     
    839839        print "run job specs=", specs, " on partion", nodelist 
    840840        if specs: 
    841             self.start_job(specs, {'location': ":".join(nodelist)}) 
     841            self.start_job(specs, {'location': nodelist}) 
    842842            #set tag false, enable scheduling another job at the same time 
    843843            self.increment_tag = False 
     
    867867        return midplane_list  
    868868     
    869     def get_next_failure(self, location, now, duration):    #change for rarm 
     869    def get_next_failure(self, location, now, duration):  
    870870        '''return the next(closest) failure moment according the partition failure list''' 
    871871         
     
    884884                                        
    885885        closest_fail_sec = MAXINT 
    886         partitions = location.split(':') 
    887          
     886        partitions = location 
     887 
    888888        midplanes = set() 
    889889        for partition in partitions: 
     
    11831183        job_end_times = {} 
    11841184        for item in end_times: 
    1185             job_end_times[item[0]] = item[1] 
    1186              
     1185            job_end_times[item[0][0]] = item[1] 
     1186                     
    11871187        now = self.get_current_time_sec() 
    11881188        for p in self.cached_partitions.itervalues():