Exemple #1
0
    def __init__(self, jobs, num_processors, scheduler, output_swf, input_file, options):

        self.num_processors = num_processors
        self.jobs = jobs
        self.terminated_jobs = []
        self.scheduler = scheduler
        self.time_of_last_job_submission = 0
        self.event_queue = EventQueue()
        self.output_swf = output_swf
        self.options = options
        self.pbar_activated = options["scheduler"]["progressbar"]

        self.machine = ValidatingMachine(num_processors=num_processors, event_queue=self.event_queue)

        if hasattr(self.scheduler, "I_NEED_A_PREDICTOR") and self.scheduler.I_NEED_A_PREDICTOR:
                self.scheduler.running_jobs = self.machine.jobs

        self.event_queue.add_handler(JobSubmissionEvent, self.handle_submission_event)
        self.event_queue.add_handler(JobTerminationEvent, self.handle_termination_event)

        if output_swf != None:
            if output_swf[-3:] == ".gz":
                import gzip
                self.output_swf = gzip.open(output_swf, 'w+')
            else:
                self.output_swf = open(output_swf, 'w+')

            # version = os.popen("git show -s --format=\"%h %ci\" HEAD").read().strip()
            # self.output_swf.write("; Computer: Pyss Simulator ("+version+")\n")
            self.output_swf.write("; Preemption: No\n")
            self.output_swf.write("; MaxNodes: -1\n")
            self.output_swf.write("; MaxProcs: "+str(num_processors)+"\n")
            self.output_swf.write("; Note: input_file:"+str(input_file)+"\n")
            self.output_swf.write("; Note: scheduler:"+str(scheduler.__class__.__name__)+"\n")
            # self.output_swf.write("; Note: options:"+str(options)+"\n")
            self.output_swf.write("; Note: if a predictor is used, the thinktime column represents the initial prediction. \n")
            self.output_swf.write("; Note: if a predictor is used, the Preceding Job Number column represents the number of under-predictions. (-1 <=> 0) \n")
            self.output_swf.write("; Note: the Partition Number column can represents it have been backfilled (-1<=>False, 1<=>True) \n")

            self.event_queue.add_handler(JobTerminationEvent, self.store_terminated_job)

        if hasattr(scheduler, "I_NEED_A_PREDICTOR") and scheduler.I_NEED_A_PREDICTOR:
            self.event_queue.add_handler(JobPredictionIsOverEvent, self.handle_prediction_event)

        for job in self.jobs:
            self.event_queue.add_event(JobSubmissionEvent(job.submit_time, job))

        if self.pbar_activated:
            widgets = ['# Jobs Terminated: ', progressbar.Counter(),' ',progressbar.Timer()]
            self.pbar = progressbar.ProgressBar(widgets=widgets,maxval=10000000, poll=0.1).start()
            self.pbari=1
    def __init__(self, jobs, num_processors, num_memory, scheduler):
        self.num_processors = num_processors
        self.num_memory = num_memory
        self.jobs = jobs
        self.terminated_jobs = []
        self.scheduler = scheduler
        self.time_of_last_job_submission = 0
        self.event_queue = EventQueue()

        self.machine = ValidatingMachine(num_processors=num_processors,
                                         num_memory=num_memory,
                                         event_queue=self.event_queue)

        self.event_queue.add_handler(JobSubmissionEvent,
                                     self.handle_submission_event)
        self.event_queue.add_handler(JobTerminationEvent,
                                     self.handle_termination_event)

        for job in self.jobs:
            self.event_queue.add_event(JobSubmissionEvent(
                job.submit_time, job))
Exemple #3
0
    def __init__(self, jobs, num_processors, scheduler):
        self.num_processors = num_processors
        self.jobs = jobs
        self.terminated_jobs = []
        self.scheduler = scheduler
        self.time_of_last_job_submission = 0
        self.event_queue = EventQueue()

        self.machine = ValidatingMachine(num_processors=num_processors,
                                         event_queue=self.event_queue)

        self.event_queue.add_handler(JobSubmissionEvent,
                                     self.handle_submission_event)
        self.event_queue.add_handler(JobTerminationEvent,
                                     self.handle_termination_event)

        if isinstance(scheduler, EasyPlusPlusScheduler) or isinstance(
                scheduler, ShrinkingEasyScheduler):
            self.event_queue.add_handler(JobPredictionIsOverEvent,
                                         self.handle_prediction_event)

        for job in self.jobs:
            self.event_queue.add_event(JobSubmissionEvent(
                job.submit_time, job))