示例#1
0
 def setup(self):
     self.slp = TimingServiceLocator()
     self.system = Simulator(config_file="simulator.xml")
     self.system_thr = ComponentProgressThread(self.system)
     self.system_thr.start()
     self.scriptm = ScriptManager()
     self.scriptm_thr = ComponentProgressThread(self.scriptm)
     self.scriptm_thr.start()
     self.qm = QueueManager()
     self.qm_thr = ComponentProgressThread(self.qm)
     self.qm_thr.start()
示例#2
0
def integrated_main(options):
    TimingServiceLocator()
    
    if opts.predict:
        histm = HistoryManager(**options)
    
    evsim = EventSimulator(**options)
    
    if opts.bgjob:
        bqsim = BGQsim(**options)
    if opts.cjob:
        cqsim = ClusterQsim(**options)
        
    if opts.bgjob and opts.cjob and opts.coscheduling:
        print "inserting 'unhold' events into event list..."
        if opts.coscheduling[0] == "hold":
            evsim.init_unhold_events(0)
        if opts.coscheduling[1] == "hold":
            evsim.init_unhold_events(1)

    if opts.adaptive:
        print "inserting metrics monitor events into event list..."
        evsim.init_mmon_events()  

    if opts.batch:
        print "simulation started"
    else:
        raw_input("Press Enter to start simulation...")
            
    starttime_sec = time.time()
    
    if opts.batch:
        while not evsim.is_finished():
            evsim.event_driver()
    else:
        while not evsim.is_finished():
            evsim.event_driver()
            os.system('clear')
            if opts.bgjob:
                bqsim.print_screen()
                pass
            if opts.cjob:
                cqsim.print_screen()
                pass
    
    if opts.bgjob:
        bqsim.post_simulation_handling()
    if opts.cjob:
        cqsim.post_simulation_handling()
       
    endtime_sec = time.time()
    print "----Simulation is finished, please check output log for further analysis.----"
示例#3
0
class TestTimingServiceLocator (TestServiceLocator):
    
    def setup (self):
        self.slp = TimingServiceLocator(expire=2)
    
    def test_init_expire (self):
        assert self.slp.expire == 2
    
    def test_expire_services (self):
        self.slp.register("foo_service", "http://localhost:5900")
        start = time.time()
        self.slp.expire_services()
        assert time.time() < start + 2
        location = self.slp.locate("foo_service")
        assert location == "http://localhost:5900"
        time.sleep(3)
        assert (time.time() - start) > 2
        self.slp.expire_services()
        location = self.slp.locate("foo_service")
        assert location == ""
示例#4
0
def integrated_main(options):
    TimingServiceLocator()

    if opts.predict:
        histm = HistoryManager(**options)

    evsim = EventSimulator(**options)

    if opts.bgjob:
        bqsim = BGQsim(**options)
    if opts.cjob:
        cqsim = ClusterQsim(**options)

    if opts.bgjob and opts.cjob and opts.coscheduling:
        print "inserting 'unhold' events into event list..."
        if opts.coscheduling[0] == "hold":
            evsim.init_unhold_events(0)
        if opts.coscheduling[1] == "hold":
            evsim.init_unhold_events(1)

    if opts.adaptive:
        print "inserting metrics monitor events into event list..."
        evsim.init_mmon_events()

    if opts.batch:
        print "simulation started"
    else:
        raw_input("Press Enter to start simulation...")

    starttime_sec = time.time()

    # dwang:
    if opts.batch:
        # --> logRec
        #
        backf_fname = './_rec_' + options.get(
            "name") + '/backf_' + options.get("name") + '_' + str(
                options.get("times")) + '.txt'
        fp_backf = open(backf_fname, 'w+')
        #
        pre_bj_fname = './_rec_' + options.get(
            "name") + '/preBj_' + options.get("name") + '_' + str(
                options.get("times")) + '.txt'
        fp_pre_bj = open(pre_bj_fname, 'w+')
        while not evsim.is_finished():
            # dwang:
            #evsim.event_driver(opts.preempt_overhead)
            #evsim.event_driver(opts.preempt_overhead,options.get("name"), options.get("times"))
            evsim.event_driver(opts.preempt_overhead, fp_backf, fp_pre_bj,
                               options.get("checkpoint"),
                               options.get("checkp_dsize"),
                               options.get("checkp_w_bandwidth"),
                               options.get("checkp_r_bandwidth"),
                               options.get("checkp_t_internval"),
                               options.get("intv_pcent"),
                               options.get("checkpH_opt"),
                               options.get("job_length_type"),
                               options.get("checkp_overhead_percentage"))
            # dwang
    else:
        while not evsim.is_finished():
            evsim.event_driver()
            os.system('clear')
            if opts.bgjob:
                bqsim.print_screen()
                pass
            if opts.cjob:
                cqsim.print_screen()
                pass

    if opts.bgjob:
        print "--- test dW-1"
        bqsim.monitor_metrics()
        print "--- test dW-2"

    if opts.bgjob:
        # dwang:
        #bqsim.post_simulation_handling()
        experiment_metrics = bqsim.post_simulation_handling(
            options.get("name"), options.get("times"),
            options.get("checkp_t_internval"), options.get("checkp_dsize"),
            options.get("checkp_w_bandwidth"))
        # dwang
    if opts.cjob:
        cqsim.post_simulation_handling()
    # dwang

    endtime_sec = time.time()
    print "----Simulation is finished, please check output log for further analysis.----"
    return experiment_metrics
示例#5
0
 def setup (self):
     self.slp = TimingServiceLocator(expire=2)