コード例 #1
0
    def _backfill_jobs(self, current_time):
        """
        Find jobs that can be backfilled and update the cpu snapshot.
        DEPRECATED FUNCTION !!!!!!
        """
        if len(self.unscheduled_jobs) <= 1:
            return []
        
        result = []


        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])
        
        first_job = self.unscheduled_jobs[0]
        self.cpu_snapshot.assignJobEarliest(first_job, current_time)
        
        for job in tail_of_waiting_list:
            if self.cpu_snapshot.canJobStartNow(job, current_time):
                job.is_backfilled = 1
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)
        self.cpu_snapshot.unAssignJob(first_job)

        return result
コード例 #2
0
    def _backfill_jobs(self, current_time):
        """
        Find jobs that can be backfilled and update the cpu snapshot.
        DEPRECATED FUNCTION !!!!!!
        """
        if len(self.unscheduled_jobs) <= 1:
            return []
        
        result = []
        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])
        first_job = self.unscheduled_jobs[0]
        starttime = self.cpu_snapshot.assignJobEarliest(first_job, current_time)
        
        job_max_procs = first_job.num_required_processors
        job_max_runtime = first_job.predicted_run_time
        
        for job in tail_of_waiting_list:
            if job.predicted_run_time >= job_max_runtime and job.num_required_processors >= job_max_procs:
                 continue
            if self.cpu_snapshot.canJobStartNow(job, current_time):
                job.is_backfilled = 1
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)
            else:
                if job.predicted_run_time <= job_max_runtime and job.num_required_processors <= job_max_procs:
                    job_max_procs = job.num_required_processors
                    job_max_runtime = job.predicted_run_time
        
        self.cpu_snapshot.unAssignJob(first_job)

        return result
コード例 #3
0
    def backfill_jobs(self, current_time):
        "overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail = list_copy(self.unscheduled_jobs[1:])
        tail_by_reverse_order = sorted(tail, key=latest_sort_key)

        self.resource_snapshot.assign_job_earliest(first_job, current_time)

        #next we have to calculate the resource utilization with different job to be backfilled
        current_util = self.current_utilization(current_time)
        result = []

        for job in tail_by_reverse_order:
            if self.resource_snapshot.can_job_start_now(job, current_time):
                utilization_with_job_backfilled = self.utilization_with_backfill(
                    job, current_time)
                if utilization_with_job_backfilled <= current_util:
                    self.unscheduled_jobs.remove(job)
                    self.resource_snapshot.assign_job(job, current_time)
                    result.append(job)

        self.resource_snapshot.del_job_from_res_slices(first_job)
        return result
コード例 #4
0
    def backfill_jobs(self, current_time):
        "overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])

        candidate_jobs = []
        for job in tail_of_waiting_list:
            if self.can_be_backfilled(job, current_time):
                candidate_jobs.append(job)

        #next we have to calculate the resource utilization with different job to be backfilled
        best_utilization = None
        result = []

        for job in candidate_jobs:
            utilization_with_job_backfilled = self.utilization_with_backfill(
                job, current_time)
            if best_utilization is None:
                best_utilization = utilization_with_job_backfilled
                result.append(job)
            else:
                if utilization_with_job_backfilled < best_utilization:
                    best_utilization = utilization_with_job_backfilled
                    result[0] = job

        if len(result) != 0:
            self.unscheduled_jobs.remove(result[0])
            self.resource_snapshot.assign_job(result[0], current_time)

        return result
コード例 #5
0
    def _reorder_jobs_in_approximate_best_order(self, current_time):

        first_job = self.unscheduled_jobs[0]
        delay = self.delay_factor * first_job.user_estimated_run_time
        cpu_snapshot_with_job = self.cpu_snapshot.quick_copy()
        cpu_snapshot_with_job.assignJobEarliest(first_job, current_time + delay)
        tail = list_copy(self.unscheduled_jobs[1:])

        # get tail from best (score, tail) tuple
        best_tail = max(
            self._scored_tail(cpu_snapshot_with_job, sort_key_func, current_time, tail)
            for sort_key_func in self.sort_key_functions
        )[1]

        return best_tail
コード例 #6
0
    def _backfill_jobs(self, current_time):
        if len(self.unscheduled_jobs) <= 1:
            return []

        result    = []  
        first_job = self.unscheduled_jobs[0]        
        tail      = list_copy(self.unscheduled_jobs[1:]) 
                
        for job in tail:
            if self.can_be_probabilistically_backfilled(job, current_time):
                self.unscheduled_jobs.remove(job)
                self.currently_running_jobs.append(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)                
        return result
コード例 #7
0
    def _backfill_jobs(self, current_time):
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail = list_copy(self.unscheduled_jobs[1:])

        for job in tail:
            if self.can_be_probabilistically_backfilled(job, current_time):
                self.unscheduled_jobs.remove(job)
                self.currently_running_jobs.append(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)
        return result
    def backfill_jobs(self, current_time):
        "overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])

        tail_by_reverse_order = sorted(tail_of_waiting_list, key=latest_sort_key)

        candidate_jobs = []

        first_job_earlist_time = self.resource_snapshot.job_earliest_assignment(first_job, current_time)
        self.resource_snapshot.assign_job(first_job, first_job_earlist_time)

        for job in tail_by_reverse_order:
            if self.resource_snapshot.can_job_start_now(job, current_time):
                if current_time + job.predicted_run_time <= first_job_earlist_time:
                    self.unscheduled_jobs.remove(job)
                    self.resource_snapshot.assign_job(job, current_time)
                    result.append(job)
                else:
                    candidate_jobs.append(job)

        #next we have to calculate the resource utilization with different job to be backfilled
        best_utilization = None
        temp_result = None


        for job in candidate_jobs:
            if self.resource_snapshot.can_job_start_now(job, current_time):
                utilization_with_job_backfilled = self.utilization_with_backfill(job, first_job_earlist_time)
                if best_utilization is None:
                    best_utilization = utilization_with_job_backfilled
                    temp_result = job
                else:
                    if utilization_with_job_backfilled < best_utilization:
                        best_utilization = utilization_with_job_backfilled
                        temp_result = job

        if temp_result != None:
            self.unscheduled_jobs.remove(temp_result)
            self.resource_snapshot.assign_job(temp_result, current_time)
            result.append(temp_result)

        self.resource_snapshot.del_job_from_res_slices(first_job)
        return result
コード例 #9
0
    def _backfill_jobs(self, current_time):
        "Overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        self._mark_jobs_in_look_ahead_best_order(current_time)

        result = []
        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])
        for job in tail_of_waiting_list:
            if job.backfill_flag == 1:
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)

        return result
コード例 #10
0
    def _reorder_jobs_in_approximate_best_order(self, current_time):

        first_job = self.unscheduled_jobs[0]
        delay = self.delay_factor * first_job.user_estimated_run_time
        cpu_snapshot_with_job = self.cpu_snapshot.quick_copy()
        cpu_snapshot_with_job.assignJobEarliest(first_job,
                                                current_time + delay)
        tail = list_copy(self.unscheduled_jobs[1:])

        # get tail from best (score, tail) tuple
        best_tail = max(
            self._scored_tail(cpu_snapshot_with_job, sort_key_func,
                              current_time, tail)
            for sort_key_func in self.sort_key_functions)[1]

        return best_tail
コード例 #11
0
    def _backfill_jobs(self, current_time):
        "Overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        self._mark_jobs_in_look_ahead_best_order(current_time)

        result = []
        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])
        for job in tail_of_waiting_list:
            if job.backfill_flag == 1:
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)

        return result
コード例 #12
0
    def backfill_jobs(self, current_time):
        """
        find jobs that can be backfilled and update the resource snapshot
        """
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []

        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])

        for job in tail_of_waiting_list:
            if self.can_be_backfilled(job, current_time):
                self.unscheduled_jobs.remove(job)
                self.resource_snapshot.assign_job(job, current_time)
                result.append(job)

        return result
コード例 #13
0
    def backfill_jobs(self, current_time):
        """
        find jobs that can be backfilled and update the resource snapshot
        """
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []

        tail_of_waiting_list = list_copy(self.unscheduled_jobs[1:])

        for job in tail_of_waiting_list:
            if self.can_be_backfilled(job, current_time):
                self.unscheduled_jobs.remove(job)
                self.resource_snapshot.assign_job(job, current_time)
                result.append(job)

        return result
コード例 #14
0
    def _backfill_jobs(self, current_time):
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail = list_copy(self.unscheduled_jobs[1:])
        tail_of_jobs_by_sjf_order = sorted(tail, key=sjf_sort_key)

        self.cpu_snapshot.assignJobEarliest(first_job, current_time)

        for job in tail_of_jobs_by_sjf_order:
            if self.cpu_snapshot.canJobStartNow(job, current_time):
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)

        self.cpu_snapshot.delJobFromCpuSlices(first_job)

        return result
コード例 #15
0
    def _backfill_jobs(self, current_time):
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []  
        first_job = self.unscheduled_jobs[0]        
        tail =  list_copy(self.unscheduled_jobs[1:])
        tail_of_jobs_by_sjf_order = sorted(tail, key=sjf_sort_key)
        
        self.cpu_snapshot.assignJobEarliest(first_job, current_time)
        
        for job in tail_of_jobs_by_sjf_order:
            if self.cpu_snapshot.canJobStartNow(job, current_time): 
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)
                
        self.cpu_snapshot.delJobFromCpuSlices(first_job)

        return result
コード例 #16
0
    def _backfill_jobs(self, current_time):
        "Overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail = list_copy(self.unscheduled_jobs[1:])
        tail_of_jobs_by_sjf_order = sorted(tail, key=sjf_sort_key)

        self.cpu_snapshot.assignJobEarliest(first_job, current_time)

        for job in tail_of_jobs_by_sjf_order:
            if self.cpu_snapshot.canJobStartNow(job, current_time):
                job.is_backfilled = 1
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)

        self.cpu_snapshot.unAssignJob(first_job)

        return result
コード例 #17
0
    def _backfill_jobs(self, current_time):
        "Overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []
        first_job = self.unscheduled_jobs[0]
        tail = list_copy(self.unscheduled_jobs[1:])
        tail_of_jobs_by_sjf_order = sorted(tail, key=sjf_sort_key)

        self.cpu_snapshot.assignJobEarliest(first_job, current_time)

        for job in tail_of_jobs_by_sjf_order:
            if self.cpu_snapshot.canJobStartNow(job, current_time):
                job.is_backfilled = 1
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)

        self.cpu_snapshot.unAssignJob(first_job)

        return result
コード例 #18
0
    def _backfill_jobs(self, current_time):
        "Overriding parent method"
        if len(self.unscheduled_jobs) <= 1:
            return []

        result = []  
        first_job = self.unscheduled_jobs[0]        
        tail =  list_copy(self.unscheduled_jobs[1:]) 
        
        self.cpu_snapshot.assignJobEarliest(first_job, current_time)
        
        for job in tail:
            job.predicted_run_time = 2 * job.user_estimated_run_time # doubling is done here 
            if self.cpu_snapshot.canJobStartNow(job, current_time): # if job can be backfilled 
                self.unscheduled_jobs.remove(job)
                self.cpu_snapshot.assignJob(job, current_time)
                result.append(job)
            else:
                job.predicted_run_time = job.user_estimated_run_time # undoubling is done here 
                
        self.cpu_snapshot.delJobFromCpuSlices(first_job)

        return result