コード例 #1
0
    def __init__(self, args):
        '''
        Constructor
        '''
        frameos = frame(time_step=200)
        frameos.attach_app(OpenSimPuller(frameos, args))

        frametest = frame(time_step=200)
        frametest.attach_app(TestSimulation(frametest))

        frameos.run_async()
        frametest.run_async()

        frame.loop()
コード例 #2
0
    def __init__(self):
        '''
        Constructor
        '''
        framenode = frame(time_step=200, instrument=True)
        framenode.attach_app(NodeSimulation(framenode))

        frametest = frame(time_step=200, instrument=True)
        frametest.attach_app(NodeTestSimulation(frametest))

        si.setup_instruments(frame.framelist)

        framenode.run_async()
        frametest.run_async()

        frame.loop()
コード例 #3
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(time_step = 1000)
        frame_car.attach_app(TrafficSimulation(frame_car))

        frame_ped = frame(time_step = 1000)
        frame_ped.attach_app(PedestrianSimulation(frame_ped))

        gfx_frame = frame(time_step = 500)
        gfx_frame.attach_app(GFXSimulation(gfx_frame))

        frame_car.run_async()
        frame_ped.run_async()
        gfx_frame.run_main()
コード例 #4
0
 def __init__(self, address, port):
     '''
     Constructor
     '''
     frame_c = frame(address = "http://" + address + ":" + port, time_step = 1000)
     frame_c.attach_app(Releaser(frame_c))
     frame_c.run()
コード例 #5
0
 def __init__(self, address, port, pattern):
     '''
     Constructor
     '''
     frame_c = frame(address="http://" + address + ":" + port,
                     time_step=1000)
     frame_c.attach_app(WhiteLister(frame_c, pattern))
     frame_c.run()
コード例 #6
0
 def __init__(self, address, port, useragentstr):
     '''
     Constructor
     '''
     frame_c = frame(address="http://" + address + ":" + port,
                     time_step=1000)
     frame_c.attach_app(Verify(frame_c, useragentstr))
     frame_c.run()
コード例 #7
0
    def __init__(self, address, port):
        '''
        Constructor
        '''
        frame_c = frame(address = "http://" + address + ":" + str(port) + "/", time_step = 1000)
        frame_c.attach_app(DeleteFrontierFrame(frame_c))

        frame_c.run_async()
        frame.loop()
コード例 #8
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_c = frame(time_step=1000)
        frame_c.attach_app(LinkValidator(frame_c))

        frame_c.run_async()
        frame.loop()
コード例 #9
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_c = frame(address="http://localhost:9000", time_step=1000)
        frame_c.attach_app(AllLinksSaver(frame_c))

        frame_c.run_async()
        frame.loop()
コード例 #10
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_car = frame(time_step=1000)
        frame_car.attach_app(TrafficSimulation(frame_car))

        frame_ped = frame(time_step=1000)
        #frame_ped.attach_app(PedestrianSimulation(frame_ped))

        con_frame = frame(time_step=500)
        #con_frame.attach_app(ConsoleSimulation(con_frame))

        frame_car.run_async()
        #frame_ped.run_async()
        #con_frame.run_async()

        frame.loop()
コード例 #11
0
    def __init__(self, name, timeout, useragent):
        '''
        Constructor
        '''
        frame_c = frame(address="http://127.0.0.1:9050", time_step=timeout)
        frame_c.attach_app(CrawlerFrame(frame_c, name, useragent))

        frame_c.run_async()
        frame.loop()
コード例 #12
0
ファイル: crawler.py プロジェクト: Noelin/WebCrawler
 def __init__(self, address, port):
     '''
     Constructor
     '''
     frame_c = frame(address="http://" + address + ":" + str(port) + "/",
                     time_step=2000)
     frame_c.attach_app(CrawlerFrame(frame_c))
     # pdb.set_trace()
     frame_c.run_async()
     frame.loop()
コード例 #13
0
    def __init__(self):
        '''
        Constructor
        '''
        frame_lb = frame(address="http://127.0.0.1:9050", time_step=1000)
        frame_lb.attach_app(LoadBalancer(frame_lb))
        frame_lv = frame(address="http://127.0.0.1:9050", time_step=1000)
        frame_lv.attach_app(LinkValidator(frame_lv))
        frame_nlg = frame(address="http://127.0.0.1:9050", time_step=1000)
        frame_nlg.attach_app(NewLinkGenerator(frame_nlg))
        frame_ds = frame(address="http://127.0.0.1:9050", time_step=1000)
        frame_ds.attach_app(DownloadedSaver(frame_ds))
        frame_buf = frame(address="http://127.0.0.1:9050", time_step=1000)
        frame_buf.attach_app(BadUrlFilter(frame_buf))

        frame_lb.run_async()
        frame_lv.run_async()
        frame_nlg.run_async()
        frame_ds.run_async()
        frame_buf.run_async()
        frame.loop()
コード例 #14
0
def Controller(settings):
    """
    Controller is the main entry point for driving the simulation.

    Arguments:
    settings -- nested dictionary with variables for configuring the connectors
    """

    laysettings = LayoutSettings.LayoutSettings(settings)
    # laysettings = None
    # load the world
    infofile = settings["General"].get("WorldInfoFile", "info.js")
    logger.info('loading world data from %s', infofile)
    world = WorldInfo.WorldInfo.LoadFromFile(infofile)
    # world = None

    cnames = settings["General"].get("Connectors",
                                     ['sumo', 'opensim', 'social', 'stats'])
    instrument = settings["General"].get("Instrument", False)
    profiling = settings["General"].get("Profiling", False)
    store_type = settings["General"].get("Store", "SimpleStore")
    process = settings["General"].get("MultiProcessing", False)
    timer = settings["General"].get("Timer", None)
    autostart = settings["General"].get("AutoStart", False)
    if timer:
        seconds = 0
        minutes = 0
        hours = 0
        if "Seconds" in timer:
            seconds = timer["Seconds"]
        if "Minutes" in timer:
            minutes = timer["Minutes"]
        if "Hours" in timer:
            hours = timer["Hours"]
        timer = datetime.timedelta(seconds=seconds,
                                   minutes=minutes,
                                   hours=hours)

    connectors = []
    for cname in cnames:
        if cname not in _SimulationControllers:
            logger.warn('skipping unknown simulation connector; %s' % (cname))
            continue

        cframe = frame(time_step=200,
                       instrument=instrument,
                       profiling=profiling)
        connector = _SimulationControllers[cname](settings, world, laysettings,
                                                  cname, cframe)
        cframe.attach_app(connector)
        connectors.append(cframe)

    if instrument:
        si.setup_instruments(connectors)

    for f in connectors:
        f.run_async()

    frame.loop()
    print "closing down controller"
    sys.exit(0)
コード例 #15
0
    def __init__(self):
        """
        constructor
        """
        wait_time = 4000  # Used in every simulation

        frame_customer_0 = frame(time_step=wait_time)
        customer_app_0 = CustomerSimulation(frame_customer_0)
        frame_customer_0.attach_app(customer_app_0)

        frame_customer_1 = frame(time_step=wait_time)
        customer_app_1 = CustomerSimulation(frame_customer_1)
        frame_customer_1.attach_app(customer_app_1)

        frame_customer_2 = frame(time_step=wait_time)
        customer_app_2 = CustomerSimulation(frame_customer_2)
        frame_customer_2.attach_app(customer_app_2)

        frame_customer_3 = frame(time_step=wait_time)
        customer_app_3 = CustomerSimulation(frame_customer_3)
        frame_customer_3.attach_app(customer_app_3)

        frame_customer_4 = frame(time_step=wait_time)
        customer_app_4 = CustomerSimulation(frame_customer_4)
        frame_customer_4.attach_app(customer_app_4)

        frame_customer_5 = frame(time_step=wait_time)
        customer_app_5 = CustomerSimulation(frame_customer_5)
        frame_customer_5.attach_app(customer_app_5)

        frame_customer_6 = frame(time_step=wait_time)
        customer_app_6 = CustomerSimulation(frame_customer_6)
        frame_customer_6.attach_app(customer_app_6)

        frame_customer_7 = frame(time_step=wait_time)
        customer_app_7 = CustomerSimulation(frame_customer_7)
        frame_customer_7.attach_app(customer_app_7)

        frame_customer_8 = frame(time_step=wait_time)
        customer_app_8 = CustomerSimulation(frame_customer_8)
        frame_customer_8.attach_app(customer_app_8)

        frame_customer_9 = frame(time_step=wait_time)
        customer_app_9 = CustomerSimulation(frame_customer_9)
        frame_customer_9.attach_app(customer_app_9)

########################################################################################################################

        frame_atm = frame(time_step=(wait_time/10))
        atm_app = ATMSimulation(frame_atm)
        frame_atm.attach_app(atm_app)

########################################################################################################################

        frame_watchdog = frame(time_step=(wait_time/10))
        watchdog_app = WatchDogSimulation(frame_watchdog)
        frame_watchdog.attach_app(watchdog_app)

########################################################################################################################

        frame_customer_0.run_async()
        frame_customer_1.run_async()
        frame_customer_2.run_async()
        frame_customer_3.run_async()
        frame_customer_4.run_async()
        frame_customer_5.run_async()
        frame_customer_6.run_async()
        frame_customer_7.run_async()
        frame_customer_8.run_async()
        frame_customer_9.run_async()

        frame_atm.run_async()

        frame_watchdog.run_async()

        frame.loop()