def main():
    
    #input_file = '/home/sharath/Desktop/pyss-read-only/src/5K_sample'
    input_file = '/home/sharath/Desktop/pyss-read-only/src/Tyrone_log'
    num_processors1 = 800
    input_file = open(input_file)
    
    scheduler = LogScheduler(num_processors1)
    #scheduler = EasyBackfillScheduler(num_processors1)

    try:
        print "...." 
        runMetaScheduler(
                num_processors = num_processors1, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), num_processors1),
                scheduler = scheduler 
            )

        #print "Num of Processors: ", options.num_processors
        #print "Input file: ", options.input_file
        #print "Scheduler:", type(scheduler)
        #print 'Total scheduled jobs:', scheduler.totalScheduledJobs
    finally:
        if input_file is not sys.stdin:
            input_file.close()
    def __init__(self):
	self.start_time = time.time()
	#input_file = '/home/siddharthsahu/Documents/scheduling/scheduling-virtualenv/prediction/prediction_time/files/tyrone_new_log'
	input_file = '/home/siddharthsahu/Documents/scheduling/scheduling-virtualenv/prediction/history_log_creation/history_log.swf'
	self.num_processors = 800
	l = 1
	input_file = open(input_file)
        if l == 1:
	    #scheduler = EasyBackfillScheduler(num_processors1)
	    self.scheduler = LogScheduler(self.num_processors)
        else:
            print "No such scheduler"
            return
	try:
	  #print "...." 
          jobs = _job_inputs_to_jobs(parse_lines(input_file), self.num_processors)
	  self.metaScheduler = MetaScheduler(jobs, self.num_processors, self.scheduler)
          #runMetaScheduler(num_processors, jobs, scheduler, metaScheduler)
          #print "Num of Processors: ", num_processors1
          #print "Input file: ", input_file
          #print "Scheduler:", type(scheduler)
          #print 'Total scheduled jobs:', scheduler.totalScheduledJobs
        finally:
          if input_file is not sys.stdin:
              input_file.close()  
Exemplo n.º 3
0
    def test_basic_easyPredictionBackfill(self):
	    specoptions = {"num_processors":2,"scheduler":{"predictor":{"name":"predictor_from_think_time"},"corrector":{"name":"reqtime"}}}
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/estimation_starvation.swf")),2))
	    
	    if simulator_finish_time(simulator) != 16:
		    raise Exception("Wrong finish time")
	    if get_id_last_job(simulator) != 2:
		    raise Exception("Wrong last job")
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/estimation_tsafrir_exemple.swf")),2))
	    simulator.scheduler.cpu_snapshot._restore_old_slices()
	    if get_jobs_at(simulator, 0) != set([1]) :
		    raise Exception("Wrong scheduling!")
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/overestimation_exemple.swf")),2))
	    
	    if simulator_finish_time(simulator) != 6:
		    raise Exception("Wrong finish time")
	    
	    specoptions["scheduler"]["predictor"]["name"] = "predictor_reqtime"
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/overestimation_exemple.swf")),2))
	    
	    if simulator_finish_time(simulator) != 8:
		    raise Exception("Wrong finish time")
Exemplo n.º 4
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "MultiDimenDoubleEasyScheduler" or options.scheduler == "1":
        scheduler = MultiDimenDoubleEasyScheduler(options.num_processors,
                                                  options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceScheduler" or options.scheduler == "2":
        scheduler = MultiDimensionResourceBalanceScheduler(
            options.num_processors, options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceReverseImprovedScheduler" or options.scheduler == "3":
        scheduler = MultiDimensionResourceBalanceReverseImprovedScheduler(
            options.num_processors, options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceTimeScheduler" or options.scheduler == "4":
        scheduler = MultiDimensionResourceBalanceTimeScheduler(
            options.num_processors, options.num_memory)
    else:
        print "No such scheduler"
        return

    try:
        print "...."
        run_simulator(num_processors=options.num_processors,
                      num_memory=options.num_memory,
                      jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                               options.num_processors,
                                               options.num_memory),
                      scheduler=scheduler)

        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()
def main1():
    print"inside forked process client"
    l = 1
    input_file = '/home/sharath/Desktop/tyrone.swf'
    num_processors1 = 800
    input_file = open(input_file)

    if l == 1:
       scheduler = EasyBackfillScheduler(num_processors1)
         
    else:
        
        return 
    try:
        #print "...." 
        runMetaScheduler(
                num_processors = num_processors1, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), num_processors1),
                scheduler = scheduler 
            )
    finally:
        if input_file is not sys.stdin:
            input_file.close()
Exemplo n.º 6
0
def parse_and_run_simulator(options):

	if options["input_file"] is None:
		parser.error("missing input file")


	if options["input_file"] == "-":
		input_file = sys.stdin
	else:
		input_file = open(options["input_file"])

	if options["num_processors"] is None:
		input_file = open(options["input_file"])
		for line in input_file:
			if(line.lstrip().startswith(';')):
				if(line.lstrip().startswith('; MaxProcs:')):
					options["num_processors"] = int(line.strip()[11:])
					break
				else:
					continue
			else:
				break

	if options["num_processors"] is None:
		parser.error("missing num processors")

	if options["stats"] is None:
		options["stats"] = False

	if sys.stdout.isatty():# You're running in a real terminal
		options["scheduler"]["progressbar"] = True
	else:# You're being piped or redirected
		options["scheduler"]["progressbar"] = False

	if options["scheduler"] is None:
		parser.error("missing scheduler")

	if options["scheduler"]["name"] is None:
		parser.error("missing scheduler name")



	my_module = options["scheduler"]["name"]
	my_class = module_to_class(my_module)

	#load module(or file)
	package = __import__ ('schedulers', fromlist=[my_module])
	if my_module not in package.__dict__:
		print "No such scheduler (module file not found)."
		return
	if my_class not in package.__dict__[my_module].__dict__:
		print "No such scheduler (class within the module file not found)."
		return
	#load the class
	scheduler_non_instancied = package.__dict__[my_module].__dict__[my_class]

	if my_module in ('maui_scheduler', 'l2r_maui_scheduler', 'online_l2r_maui_scheduler'):
		scheduler = scheduler_non_instancied(options, \
			# weights_list=options["weights"], \
			weights_backfill=options["weights"])
	else:
		scheduler = scheduler_non_instancied(options)

	# scheduler = scheduler_non_instancied(options\
	# 	, weights_list=options["weights"], weights_backfill=options["weights"])


	#if hasattr(scheduler_non_instancied, 'I_NEED_A_PREDICTOR'):

	try:
		# print "...."

		starttime = datetime.today()
		sim = run_simulator(
			num_processors = options["num_processors"],
			jobs = _job_inputs_to_jobs(parse_lines(input_file), options["num_processors"]),
			scheduler = scheduler,
			output_swf = options["output_swf"] if "output_swf" in options else None,
			input_file = options["input_file"],
			no_stats = not(options["stats"]),
			options = options
			)
		end_time = datetime.today() - starttime

		options["terminated_jobs"] = sim.get_terminated_jobs()

		print "\b" * 50

		if options.get("verbose", False):
			print "\n"
			print "Num of Processors: ", options["num_processors"]
			print "Input file: ", options["input_file"]
			print "Scheduler:", type(scheduler)
			print "Elapsed Time:", end_time

	finally:
		if input_file is not sys.stdin:
			input_file.close()

	return end_time
Exemplo n.º 7
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "FcfsScheduler" or options.scheduler == "1":
        scheduler = FcfsScheduler(options.num_processors)

    elif options.scheduler == "ConservativeScheduler" or options.scheduler == "2":
        scheduler = ConservativeScheduler(options.num_processors)

    elif options.scheduler == "DoubleConservativeScheduler" or options.scheduler == "3":
        scheduler = DoubleConservativeScheduler(options.num_processors)

    elif options.scheduler == "EasyBackfillScheduler" or options.scheduler == "4":
        scheduler = EasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "DoubleEasyBackfillScheduler" or options.scheduler == "5":
        scheduler = DoubleEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "GreedyEasyBackfillScheduler" or options.scheduler == "6":
        scheduler = GreedyEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "EasyPlusPlusScheduler" or options.scheduler == "7":
        scheduler = EasyPlusPlusScheduler(options.num_processors)

    elif options.scheduler == "ShrinkingEasyScheduler" or options.scheduler == "8":
        scheduler = ShrinkingEasyScheduler(options.num_processors)

    elif options.scheduler == "LookAheadEasyBackFillScheduler" or options.scheduler == "9":
        scheduler = LookAheadEasyBackFillScheduler(options.num_processors)

    elif options.scheduler == "EasySJBFScheduler" or options.scheduler == "10":
        scheduler = EasySJBFScheduler(options.num_processors)

    elif options.scheduler == "HeadDoubleEasyScheduler" or options.scheduler == "11":
        scheduler = HeadDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "TailDoubleEasyScheduler" or options.scheduler == "12":
        scheduler = TailDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "OrigProbabilisticEasyScheduler" or options.scheduler == "13":
        scheduler = OrigProbabilisticEasyScheduler(options.num_processors)

    elif options.scheduler == "ReverseEasyScheduler" or options.scheduler == "14":
        scheduler = ReverseEasyScheduler(options.num_processors)

    elif options.scheduler == "PerfectEasyBackfillScheduler" or options.scheduler == "15":
        scheduler = PerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "DoublePerfectEasyBackfillScheduler" or options.scheduler == "16":
        scheduler = DoublePerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "AlphaEasyScheduler" or options.scheduler == "18":
        scheduler = AlphaEasyScheduler(options.num_processors)

    elif options.scheduler == "CommonDistEasyPlusPlusScheduler" or options.scheduler == "28":
        scheduler = CommonDistEasyPlusPlusScheduler(options.num_processors)

    else:
        print "No such scheduler"
        return

    try:
        print "...."
        run_simulator(num_processors=options.num_processors,
                      jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                               options.num_processors),
                      scheduler=scheduler)

        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()
Exemplo n.º 8
0
    """interactive print: switch to interactive python shell if --interactive is asked."""
    if not p==None:
        print(p)
    if arguments['--interactive']==True:
        from IPython import embed
        embed()

def _my_job_inputs_to_jobs(job_inputs, total_num_processors):
    for job_input in job_inputs:
        j=_job_input_to_job(job_input, total_num_processors)
        j.wait_time=job_input.wait_time
        yield j

iprint("Opening the swf file.")
with open(arguments['<swf_file>'], 'rt') as  f:
    jobs = _my_job_inputs_to_jobs(parse_lines(f), num_processors)
    print("Parsed swf file.")

    print("Choosing predictor.")
    if config["scheduler"]["predictor"]["name"]=="predictor_tsafrir":
        from predictors.predictor_tsafrir import PredictorTsafrir
        predictor=PredictorTsafrir({})
    elif config["scheduler"]["predictor"]["name"]=="predictor_clairvoyant":
        from predictors.predictor_clairvoyant import PredictorClairvoyant
        predictor=PredictorClairvoyant({})
    elif config["scheduler"]["predictor"]["name"]=="predictor_reqtime":
        from predictors.predictor_reqtime import PredictorReqtime
        predictor=PredictorReqtime({})
    elif config["scheduler"]["predictor"]["name"]=="predictor_double_reqtime":
        from predictors.predictor_double_reqtime import PredictorDoubleReqtime
        predictor=PredictorDoubleReqtime({})
    def new_events_on_job_termination(self, job, current_time):

        if OnlineL2RMauiScheduler.I_NEED_A_PREDICTOR:
            self.predictor.fit(job, current_time)
            # ps = [self.pred_tsafrir, self.pred_sgd_linear]
            # for p in ps:
            #     p.predict(job, current_time, self.running_jobs)
            #     p.fit(job, current_time)
            # job.predicted_run_time = job.user_estimated_run_time

        self.terminated_jobs.append(Simulator._convert_job_to_str(job))
        self.curr_jobs_num += 1

        if self.curr_jobs_num == OnlineL2RMauiScheduler.job_per_part:
            self.curr_jobs_num = 0
            self.curr_part_num += 1

            training_file = self.rel("train.swf")
            write_lines_to_file(training_file, self.terminated_jobs)


            self.terminated_jobs[:] = []

            outf = self._prepare_training_set_file(training_file)
            # print "outf", outf
            if self.curr_part_num >= OnlineL2RMauiScheduler.max_parts_num:
                self.best_all.popleft()
                self.queries.popleft()
            self.best_all.append(outf)


            x = parse_lines(open(outf))
            jobs = _job_inputs_to_jobs_with_wait(x, self.num_processors)
            # jobs_str = map(lambda u: extract_features_for_training(u), jobs)
            jobs_str = []
            for j in jobs:
                p = self.predict_all(j, current_time)
                jobs_str.append(extract_features_for_training(j, p))
                p.extend(get_comb(p))
                self.X.append(p)
                self.y.append(j.actual_run_time)
            query = convert_jobs_to_ml_format(jobs_str, self.curr_part_num)
            self.queries.append(query)

            self.log = LinearRegression(normalize=True)
            self.log.fit(self.X, self.y)

            self.every += 1
            self.every %= 10
            if self.every == 0:
                train_fn = 'train.txt'
                # features = OnlineL2RMauiScheduler._merge_and_create_ml_training_file(\
                #     self.best_all)
                write_lines_to_file(self.rel(train_fn), self.queries)
                model_fn = "model_{0}.txt".format(self.curr_part_num)

                # ## single process training
                # self.batchL2Rlib.train(train_fn, model_fn)
                # self.curr_model_fn = model_fn
                # print "curr_model_fn:", self.curr_model_fn
                # self.lib.update_model(self.rel(self.curr_model_fn))

                ## training in another thread
                p = multiprocessing.Process(target=train, \
                    args=(self.batchL2Rlib, train_fn, model_fn))
                p.start()
                p.join(10 * 60)

                # If thread is still active
                if p.is_alive():
                    print "running... let's kill it..."
                    p.terminate()
                    p.join()
                else:
                    self.curr_model_fn = model_fn
                    print "curr_model_fn:", self.curr_model_fn
                    self.lib.update_model(self.rel(self.curr_model_fn))

        return super(OnlineL2RMauiScheduler, self).new_events_on_job_termination(job, current_time)
Exemplo n.º 10
0
    def new_events_on_job_termination(self, job, current_time):

        if OnlineL2RMauiScheduler.I_NEED_A_PREDICTOR:
            self.predictor.fit(job, current_time)
            # ps = [self.pred_tsafrir, self.pred_sgd_linear]
            # for p in ps:
            #     p.predict(job, current_time, self.running_jobs)
            #     p.fit(job, current_time)
            # job.predicted_run_time = job.user_estimated_run_time

        self.terminated_jobs.append(Simulator._convert_job_to_str(job))
        self.curr_jobs_num += 1

        if self.curr_jobs_num == OnlineL2RMauiScheduler.job_per_part:
            self.curr_jobs_num = 0
            self.curr_part_num += 1

            training_file = self.rel("train.swf")
            write_lines_to_file(training_file, self.terminated_jobs)

            self.terminated_jobs[:] = []

            outf = self._prepare_training_set_file(training_file)
            # print "outf", outf
            if self.curr_part_num >= OnlineL2RMauiScheduler.max_parts_num:
                self.best_all.popleft()
                self.queries.popleft()
            self.best_all.append(outf)

            x = parse_lines(open(outf))
            jobs = _job_inputs_to_jobs_with_wait(x, self.num_processors)
            # jobs_str = map(lambda u: extract_features_for_training(u), jobs)
            jobs_str = []
            for j in jobs:
                p = self.predict_all(j, current_time)
                jobs_str.append(extract_features_for_training(j, p))
                p.extend(get_comb(p))
                self.X.append(p)
                self.y.append(j.actual_run_time)
            query = convert_jobs_to_ml_format(jobs_str, self.curr_part_num)
            self.queries.append(query)

            self.log = LinearRegression(normalize=True)
            self.log.fit(self.X, self.y)

            self.every += 1
            self.every %= 10
            if self.every == 0:
                train_fn = 'train.txt'
                # features = OnlineL2RMauiScheduler._merge_and_create_ml_training_file(\
                #     self.best_all)
                write_lines_to_file(self.rel(train_fn), self.queries)
                model_fn = "model_{0}.txt".format(self.curr_part_num)

                # ## single process training
                # self.batchL2Rlib.train(train_fn, model_fn)
                # self.curr_model_fn = model_fn
                # print "curr_model_fn:", self.curr_model_fn
                # self.lib.update_model(self.rel(self.curr_model_fn))

                ## training in another thread
                p = multiprocessing.Process(target=train, \
                    args=(self.batchL2Rlib, train_fn, model_fn))
                p.start()
                p.join(10 * 60)

                # If thread is still active
                if p.is_alive():
                    print "running... let's kill it..."
                    p.terminate()
                    p.join()
                else:
                    self.curr_model_fn = model_fn
                    print "curr_model_fn:", self.curr_model_fn
                    self.lib.update_model(self.rel(self.curr_model_fn))

        return super(OnlineL2RMauiScheduler,
                     self).new_events_on_job_termination(job, current_time)
Exemplo n.º 11
0
        print(p)
    if arguments['--interactive'] == True:
        from IPython import embed
        embed()


def _my_job_inputs_to_jobs(job_inputs, total_num_processors):
    for job_input in job_inputs:
        j = _job_input_to_job(job_input, total_num_processors)
        j.wait_time = job_input.wait_time
        yield j


iprint("Opening the swf file.")
with open(arguments['<swf_file>'], 'rt') as f:
    jobs = _my_job_inputs_to_jobs(parse_lines(f), num_processors)
    print("Parsed swf file.")

    print("Choosing predictor.")
    if config["scheduler"]["predictor"]["name"] == "predictor_tsafrir":
        from predictors.predictor_tsafrir import PredictorTsafrir
        predictor = PredictorTsafrir({})
    elif config["scheduler"]["predictor"]["name"] == "predictor_clairvoyant":
        from predictors.predictor_clairvoyant import PredictorClairvoyant
        predictor = PredictorClairvoyant({})
    elif config["scheduler"]["predictor"]["name"] == "predictor_reqtime":
        from predictors.predictor_reqtime import PredictorReqtime
        predictor = PredictorReqtime({})
    elif config["scheduler"]["predictor"][
            "name"] == "predictor_double_reqtime":
        from predictors.predictor_double_reqtime import PredictorDoubleReqtime
Exemplo n.º 12
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)
    try:
        print "...."

        # Site 1
        Blacklight = SiteData()
        Blacklight.location = "Pittsburgh"
        Blacklight.name = "Blacklight"
        Blacklight.cores = 4096
        Blacklight.powerPerCore = 87.89  # Watts
        Blacklight.timeZoneLag = 0
        Blacklight.gflops = 9.0
        Blacklight.max_ert = 86400
        Blacklight.max_req = 1024

        # Site 2
        Darter = SiteData()
        Darter.location = "Tennessee"
        Darter.name = "Darter"
        Darter.cores = 11968
        Darter.powerPerCore = 30.588624
        Darter.timeZoneLag = -1
        Darter.gflops = 20.79
        Darter.max_ert = 86400
        Darter.max_req = 2048

        # Site 3
        Gordon = SiteData()
        Gordon.location = "San Diego"
        Gordon.name = "Gordon"
        Gordon.cores = 16160
        Gordon.powerPerCore = 22.178218
        Gordon.timeZoneLag = -3
        Gordon.gflops = 21.10
        Gordon.max_ert = 172800
        Gordon.max_req = 1024

        # Site 4
        Trestles = SiteData()
        Trestles.location = "San Diego"
        Trestles.name = "Trestles"
        Trestles.cores = 10368
        Trestles.powerPerCore = 42.6697
        Trestles.timeZoneLag = -3
        Trestles.gflops = 9.64
        Trestles.max_ert = 172800
        Trestles.max_req = 1024

        # Site 5
        Mason = SiteData()
        Mason.location = "Indiana"
        Mason.name = "Mason"
        Mason.cores = 576
        Mason.powerPerCore = 39.952891
        Mason.timeZoneLag = 0
        Mason.gflops = 7.43
        Mason.max_ert = 172800
        Mason.max_req = 128

        # Site 6
        Lonestar = SiteData()
        Lonestar.location = "Texas"
        Lonestar.name = "Lonestar"
        Lonestar.cores = 22656
        Lonestar.powerPerCore = 15.83
        Lonestar.timeZoneLag = 2
        Lonestar.gflops = 13.33
        Lonestar.max_ert = 86400
        Lonestar.max_req = 4096

        # Site 7
        Queenbee = SiteData()
        Queenbee.location = "Louisiana"
        Queenbee.name = "Queenbee"
        Queenbee.cores = 5440
        Queenbee.powerPerCore = 16.25
        Queenbee.timeZoneLag = -1
        Queenbee.gflops = 9.38
        Queenbee.max_ert = 259200
        Queenbee.max_req = 2048

        # Site 8
        Steele = SiteData()
        Steele.location = "Indiana"
        Steele.name = "Steele"
        Steele.cores = 4992
        Steele.powerPerCore = 83.75
        Steele.timeZoneLag = 0
        Steele.gflops = 13.34
        Steele.max_ert = 259200
        Steele.max_req = 1024

        SiteList = [
            Blacklight, Darter, Gordon, Trestles, Mason, Lonestar, Queenbee,
            Steele
        ]
        input = []
        siteCount = 1
        maxProcessors = 0
        sumProcessors = 0
        for site in SiteList:
            maxProcessors = max(maxProcessors, site.cores)
            sumProcessors = maxProcessors + site.cores
            input.append(
                Site(siteCount, site.location, site.name,
                     site.timeZoneLag, site.cores,
                     EasyBackfillScheduler(site.cores), site.powerPerCore,
                     site.gflops, site.max_ert, site.max_req))
            siteCount += 1

        alpha = options.alpha
        beta = options.beta
        algorithm = options.algorithm
        joblimit = options.joblimit
        ''' 
        * Algorithm 1 - MCMF
        * Algorithm 2 - INST
	* 3 - two price
        '''

        runMetaScheduler(input,
                         jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                                  maxProcessors),
                         alpha=alpha,
                         beta=beta,
                         algorithm=algorithm,
                         joblimit=options.joblimit,
                         maxq=options.maxq,
                         pfile=options.pfile,
                         mperc=options.mperc,
                         pricepath=options.pricepath)

        #print "Num of Processors: ", sumProcessors
        print "Alpha=", alpha, "Beta=", beta
        print "Input file: ", options.input_file

    finally:
        if input_file is not sys.stdin:
            input_file.close()
Exemplo n.º 13
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "FcfsScheduler" or options.scheduler == "1":
        scheduler = FcfsScheduler(options.num_processors)

    elif options.scheduler == "ConservativeScheduler" or options.scheduler =="2":
        scheduler = ConservativeScheduler(options.num_processors)

    elif options.scheduler == "DoubleConservativeScheduler" or options.scheduler == "3":
        scheduler = DoubleConservativeScheduler(options.num_processors)

    elif options.scheduler == "EasyBackfillScheduler" or options.scheduler == "4":
        scheduler = EasyBackfillScheduler(options.num_processors)
        
    elif options.scheduler == "DoubleEasyBackfillScheduler" or options.scheduler == "5":
        scheduler = DoubleEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "GreedyEasyBackfillScheduler" or options.scheduler == "6":
        scheduler = GreedyEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "EasyPlusPlusScheduler" or options.scheduler == "7":
        scheduler = EasyPlusPlusScheduler(options.num_processors)
        
    elif options.scheduler == "ShrinkingEasyScheduler" or options.scheduler == "8":
        scheduler = ShrinkingEasyScheduler(options.num_processors)

    elif options.scheduler == "LookAheadEasyBackFillScheduler" or options.scheduler == "9":
        scheduler = LookAheadEasyBackFillScheduler(options.num_processors)

    elif options.scheduler == "EasySJBFScheduler" or options.scheduler == "10":
        scheduler = EasySJBFScheduler(options.num_processors)

    elif options.scheduler == "HeadDoubleEasyScheduler" or options.scheduler == "11":
        scheduler = HeadDoubleEasyScheduler(options.num_processors)
        
    elif options.scheduler == "TailDoubleEasyScheduler" or options.scheduler == "12":
        scheduler = TailDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "OrigProbabilisticEasyScheduler" or options.scheduler == "13":
        scheduler = OrigProbabilisticEasyScheduler(options.num_processors)    

    elif options.scheduler == "ReverseEasyScheduler" or options.scheduler == "14":
        scheduler = ReverseEasyScheduler(options.num_processors)
        
    elif options.scheduler == "PerfectEasyBackfillScheduler" or options.scheduler == "15":
        scheduler = PerfectEasyBackfillScheduler(options.num_processors)
        
    elif options.scheduler == "DoublePerfectEasyBackfillScheduler" or options.scheduler == "16":
        scheduler = DoublePerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "AlphaEasyScheduler" or options.scheduler == "18":
        scheduler = AlphaEasyScheduler(options.num_processors)

    elif options.scheduler == "CommonDistEasyPlusPlusScheduler" or options.scheduler == "28":
        scheduler = CommonDistEasyPlusPlusScheduler(options.num_processors)
        

    
    else:
        print "No such scheduler"
        return 

    try:
        print "...." 
        run_simulator(
                num_processors = options.num_processors, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), options.num_processors),
                scheduler = scheduler 
            )
        
        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()