print ("TESTING : connectionSectorLocation_singleton_capability")
    svc = MobileProbeService(connectionSectorLocation_singleton_capability(devices))
    spec = mplane.model.Specification(capability=svc.capability())
    spec.set_parameter_value("source.device", "353918050540026")
    spec.set_when("2013-09-20 ... 2013-10-5")
    res = svc.run(spec, lambda: False)
    print(repr(res))
    print(mplane.model.unparse_yaml(res))


# For right now, start a Tornado-based ping server
if __name__ == "__main__":
    global args

    #initialize the registry
    mplane.model.initialize_registry()

    #MANUAL TEST (DISABLE NORMALY)
    manually_test_capability()
    exit()

    #create the scheduler 
    scheduler = mplane.scheduler.Scheduler()
    #get devices 
    devices = getAvailableDevicesFromDB()
    #add all the capabilities
    scheduler.add_service(MobileProbeService(connectionSector_singleton_capability(devices)))
    scheduler.add_service(MobileProbeService(connectionSectorLocation_singleton_capability(devices)))
    #run the scheduler 
    mplane.httpsrv.runloop(scheduler)
    parse_soap_section()

    pvsr_defaults()

    preload_soap_data()

    mplane.model.initialize_registry()
    scheduler = mplane.scheduler.Scheduler()

    for name in sorted(config["measurements"].keys()):
        meas = config["measurements"][name]
        if meas["verb_query"]:
            scheduler.add_service(
                pvsr_proxy_service.PvsrService(
                    meas, mplane.model.VERB_QUERY, pvsr,
                    config["default_site"],
                    config["delete_created_measurements"],
                    config["pvsr_default_conf_check_cycle"], pvsr_meas_types))
        if meas["verb_measure"]:
            scheduler.add_service(
                pvsr_proxy_service.PvsrService(
                    meas, mplane.model.VERB_MEASURE, pvsr,
                    config["default_site"],
                    config["delete_created_measurements"],
                    config["pvsr_default_conf_check_cycle"], pvsr_meas_types))

    logging.info("starting service")

    mplane.httpsrv.runloop(scheduler)
Exemple #3
0
        for m in YouTubeMetrics:
            e = mplane.model.element(m)
            # some numbers are returned as floats: need to int() them
            if  str(e._prim) == 'natural':
                r = int(metrics[m])
            else:
                r = metrics[m]

            res.set_result_value(m, r)

        return res

def parse_args():
    global video_id
    # parser = argparse.ArgumentParser(description="Run an mPlane YouTube probe server")
    # args = parser.parse_args()
    video_id = "riyXuGoqJlY"
    if len(sys.argv) >= 2:
        video_id = sys.argv[1]

# For right now, start a Tornado-based ping server
if __name__ == "__main__":

    mplane.model.initialize_registry()
    parse_args()

    scheduler = mplane.scheduler.Scheduler()
    scheduler.add_service(YouTubeProbeService(youtube_capability(video_id)))

    mplane.httpsrv.runloop(scheduler)
Exemple #4
0
    spec.set_parameter_value("source.device", "353918050540026")
    spec.set_when("2013-09-20 ... 2013-10-5")
    res = svc.run(spec, lambda: False)
    print(repr(res))
    print(mplane.model.unparse_yaml(res))


# For right now, start a Tornado-based ping server
if __name__ == "__main__":
    global args

    #initialize the registry
    mplane.model.initialize_registry()

    #MANUAL TEST (DISABLE NORMALY)
    manually_test_capability()
    exit()

    #create the scheduler
    scheduler = mplane.scheduler.Scheduler()
    #get devices
    devices = getAvailableDevicesFromDB()
    #add all the capabilities
    scheduler.add_service(
        MobileProbeService(connectionSector_singleton_capability(devices)))
    scheduler.add_service(
        MobileProbeService(
            connectionSectorLocation_singleton_capability(devices)))
    #run the scheduler
    mplane.httpsrv.runloop(scheduler)