Exemplo n.º 1
0
def main():

        # Load currently active subscriptions
        jx = Junxon()
        jx.init_active()

        # Daemonize PyroJunxon
	Pyro.core.initServer()
	daemon = Pyro.core.Daemon()
	ns = Pyro.naming.NameServerLocator().getNS()
	daemon.useNameServer(ns)

	try:
		ns.createGroup(JUNXON_GROUP)
	except NamingError:
		pass
	try:
		ns.unregister(JUNXON_NAME)
	except NamingError:
		pass

	uri=daemon.connect(Junxond(),JUNXON_NAME)

	sys.stdout.write('Junxon Ready...')
	daemon.requestLoop()
Exemplo n.º 2
0
def runner(vm_name, module_name, ip_addr, name_server):
    # import from custom test script
    importlib.import_module(module_name)

    test_class = inspect.getmembers(sys.modules[module_name],
                                    inspect.isclass)[0][1]

    test_inst = test_class()

    Pyro4.config.HOST = ip_addr

    daemon = Pyro4.Daemon()
    ns = Pyro4.locateNS(host=name_server)
    uri = daemon.register(test_inst)

    print 'Registered URI: "%s"' % uri

    obj_path = "runner.%s.%s" % (vm_name, module_name)

    # try to lookup the name if already exist

    is_exist = True
    try:
        print 'Looking up existing object'
        old_uri = ns.lookup(obj_path)
        print 'Found existing object: "%s"', old_uri
    except Pyro4.errors.NamingError:
        # the object doesn't exist
        is_exist = False

    if is_exist:
        print 'Object already exist on NS, removing...'
        ns.remove(obj_path)

    ns.register(obj_path, uri)
    print 'Object registered as "%s"' % obj_path

    print 'Initiating request loop'
    daemon.requestLoop()
Exemplo n.º 3
0
def runner(vm_name, module_name, ip_addr, name_server):
    # import from custom test script
    importlib.import_module(module_name)

    test_class = inspect.getmembers(sys.modules[module_name], inspect.isclass)[0][1]

    test_inst = test_class()

    Pyro4.config.HOST = ip_addr

    daemon=Pyro4.Daemon()
    ns = Pyro4.locateNS(host=name_server)
    uri = daemon.register(test_inst)

    print 'Registered URI: "%s"' % uri

    obj_path = "runner.%s.%s" % (vm_name, module_name)

    # try to lookup the name if already exist

    is_exist = True
    try:
        print 'Looking up existing object'
        old_uri = ns.lookup(obj_path)
        print 'Found existing object: "%s"', old_uri
    except Pyro4.errors.NamingError:
        # the object doesn't exist
        is_exist = False

    if is_exist:
        print 'Object already exist on NS, removing...'
        ns.remove(obj_path)

    ns.register(obj_path, uri)
    print 'Object registered as "%s"' % obj_path

    print 'Initiating request loop'
    daemon.requestLoop()