Exemple #1
0
 def new_events_on_job_termination(self, job, current_time):
     self.cpu_snapshot.archive_old_slices(current_time)
     self.cpu_snapshot.delTailofJobFromCpuSlices(job)
     return [
         JobStartEvent(current_time, job)
         for job in self._schedule_jobs(current_time)
     ]
Exemple #2
0
    def new_events_on_job_submission(self, job, current_time):
        # print "arrived:", job
        rounded_up_estimated_time = _round_time_up(job.user_estimated_run_time)

        if rounded_up_estimated_time > self.max_user_rounded_estimated_run_time:
            self.prev_max_user_rounded_estimated_run_time = self.max_user_rounded_estimated_run_time
            self.max_user_rounded_estimated_run_time = rounded_up_estimated_time

        if not self.user_distribution.has_key(job.user_id):
            self.user_distribution[job.user_id] = Distribution(
                job, self.window_size)
        self.user_distribution[job.user_id].touch(
            2 * self.max_user_rounded_estimated_run_time)

        if self.prev_max_user_rounded_estimated_run_time < self.max_user_rounded_estimated_run_time:
            for tmp_job in self.currently_running_jobs:
                self.user_distribution[tmp_job.user_id].touch(
                    2 * self.max_user_rounded_estimated_run_time)

        self.cpu_snapshot.archive_old_slices(current_time)
        self.unscheduled_jobs.append(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
Exemple #3
0
 def new_events_on_job_submission(self, job, current_time):
     self.cpu_snapshot.archive_old_slices(current_time)
     self.waiting_queue_of_jobs.append(job)
     return [
         JobStartEvent(current_time, job)
         for job in self._schedule_jobs(current_time)
     ]
Exemple #4
0
 def new_events_on_job_submission(self, just_submitted_job, current_time):
     just_submitted_job.predicted_run_time = 2 * just_submitted_job.user_estimated_run_time
     self.resource_snapshot.archive_old_slices(current_time)
     self.unscheduled_jobs.append(just_submitted_job)
     return [
         JobStartEvent(current_time, job)
         for job in self.schedule_jobs(current_time)
     ]
Exemple #5
0
 def new_events_on_job_termination(self, job, current_time):
     self.user_distribution[job.user_id].add_job(job)
     self.currently_running_jobs.remove(job)
     self.cpu_snapshot.archive_old_slices(current_time)
     self.cpu_snapshot.delTailofJobFromCpuSlices(job)
     return [
         JobStartEvent(current_time, job)
         for job in self._schedule_jobs(current_time)
     ]
Exemple #6
0
 def new_events_on_job_termination(self, job, current_time):
     """ Here we first delete the tail of the just terminated job (in case it's
     done before user estimation time). We then try to schedule the jobs in the waiting list,
     returning a collection of new termination events """
     self.cpu_snapshot.archive_old_slices(current_time)
     self.cpu_snapshot.delTailofJobFromCpuSlices(job)
     return [
         JobStartEvent(current_time, job)
         for job in self._schedule_jobs(current_time)
     ]
Exemple #7
0
    def new_events_on_job_termination(self, job, current_time):
        assert self.user_jobs.has_key(job.user_id) == True

        self.user_jobs[job.user_id].append(job)
        self.cpu_snapshot.archive_old_slices(current_time)
        self.cpu_snapshot.delTailofJobFromCpuSlices(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
Exemple #8
0
    def new_events_on_job_submission(self, job, current_time):
        if not self.user_jobs.has_key(job.user_id):
            self.user_jobs[job.user_id] = []

        self.cpu_snapshot.archive_old_slices(current_time)
        self.unscheduled_jobs.append(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
Exemple #9
0
 def new_events_on_job_submission(self, just_submitted_job, current_time):
     """ Here we first add the new job to the waiting list. We then try to schedule
     the jobs in the waiting list, returning a collection of new termination events """
     # TODO: a probable performance bottleneck because we reschedule all the
     # jobs. Knowing that only one new job is added allows more efficient
     # scheduling here.
     self.cpu_snapshot.archive_old_slices(current_time)
     self.unscheduled_jobs.append(just_submitted_job)
     return [
         JobStartEvent(current_time, job)
         for job in self._schedule_jobs(current_time)
     ]
 def _reschedule_jobs(self, current_time):
     newEvents = []
     for job in self.unfinished_jobs_by_submit_time:
         if job.start_to_run_at_time <= current_time:
             continue  # job started to run before, so it cannot be rescheduled (preemptions are not allowed)
         prev_start_to_run_at_time = job.start_to_run_at_time
         self.cpu_snapshot.delJobFromCpuSlices(job)
         self.cpu_snapshot.assignJobEarliest(job, current_time)
         assert prev_start_to_run_at_time >= job.start_to_run_at_time
         if prev_start_to_run_at_time != job.start_to_run_at_time:
             newEvents.append(JobStartEvent(job.start_to_run_at_time, job))
     return newEvents
    def new_events_on_job_termination(self, job, current_time):
        assert self.user_run_time_last.has_key(job.user_id) == True
        assert self.user_run_time_prev.has_key(job.user_id) == True

        self.user_run_time_prev[job.user_id] = self.user_run_time_last[
            job.user_id]
        self.user_run_time_last[job.user_id] = job.actual_run_time
        self.cpu_snapshot.archive_old_slices(current_time)
        self.cpu_snapshot.delTailofJobFromCpuSlices(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
Exemple #12
0
    def new_events_on_job_termination(self, job, current_time):
        self.predictor.fit(job, current_time)

        if self.corrector.__name__ == "ninetynine":
            self.pestimator.fit(job.actual_run_time /
                                job.user_estimated_run_time)

        self.cpu_snapshot.archive_old_slices(current_time)
        self.cpu_snapshot.delTailofJobFromCpuSlices(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
Exemple #13
0
    def new_events_on_job_submission(self, job, current_time):

        self.cpu_snapshot.archive_old_slices(current_time)
        self.predictor.predict(job, current_time, self.running_jobs)

        self.ff.write("%d\t%d\n" %
                      (job.actual_run_time, job.predicted_run_time))
        self.ff.flush()

        if not hasattr(job, "initial_prediction"):
            job.initial_prediction = job.predicted_run_time
        self.unscheduled_jobs.append(job)
        return [
            JobStartEvent(current_time, job)
            for job in self._schedule_jobs(current_time)
        ]
    def new_events_on_job_under_prediction(self, job, current_time):
        assert job.predicted_run_time <= job.user_estimated_run_time

        if not hasattr(job,"num_underpredict"):
            job.num_underpredict = 0
        else:
            job.num_underpredict += 1

        if self.corrector.__name__=="ninetynine":
            new_predicted_run_time = self.corrector(self.pestimator,job,current_time)
        else:
            new_predicted_run_time = self.corrector(job, current_time)

        #set the new predicted runtime
        self.cpu_snapshot.assignTailofJobToTheCpuSlices(job, new_predicted_run_time)
        job.predicted_run_time = new_predicted_run_time

        return [JobStartEvent(current_time, job)]
 def new_events_on_job_submission(self, job, current_time):
     self.cpu_snapshot.archive_old_slices(current_time)
     self.unfinished_jobs_by_submit_time.append(job)
     self.cpu_snapshot.assignJobEarliest(job, current_time)
     return [JobStartEvent(job.start_to_run_at_time, job)]
Exemple #16
0
 def new_events_on_job_under_prediction(self, job, current_time):
     assert job.predicted_run_time <= job.user_estimated_run_time
     new_predicted_run_time = common_correctors.reqtime(job, current_time)
     self.cpu_snapshot.assignTailofJobToTheCpuSlices(job, new_predicted_run_time)
     job.predicted_run_time = new_predicted_run_time
     return [JobStartEvent(current_time, job)]