How to use the rpyc.utils.server.ThreadedServer function in rpyc

To help you get started, we’ve selected a few rpyc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / tashi / src / tashi / nodemanager / nodemanager.py View on Github external
(config, configFiles) = getConfig(["NodeManager"])
	publisher = instantiateImplementation(config.get("NodeManager", "publisher"), config)
	tashi.publisher = publisher
	logging.config.fileConfig(configFiles)
	log = logging.getLogger(__name__)
	log.info('Using configuration file(s) %s' % configFiles)
	dfs = instantiateImplementation(config.get("NodeManager", "dfs"), config)
	vmm = instantiateImplementation(config.get("NodeManager", "vmm"), config, dfs, None)
	service = instantiateImplementation(config.get("NodeManager", "service"), config, vmm)
	vmm.nm = service

	if boolean(config.get("Security", "authAndEncrypt")):
		users = {}
		users[config.get('AllowedUsers', 'clusterManagerUser')] = config.get('AllowedUsers', 'clusterManagerPassword')
		authenticator = TlsliteVdbAuthenticator.from_dict(users)
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService', 'port')), auto_register=False, authenticator=authenticator)
	else:
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('NodeManagerService', 'port')), auto_register=False)
	t.logger.setLevel(logging.ERROR)
	t.service.service = service
	t.service._type = 'NodeManagerService'

	debugConsole(globals())
	
	try:
		t.start()
	except KeyboardInterrupt:
		handleSIGTERM(signal.SIGTERM, None)
	except Exception, e:
		sys.stderr.write(str(e) + "\n")
		sys.exit(-1)
github Luxoft / Twister / server / UserService.py View on Github external
except Exception:
        USER_NAME = ''
    if not USER_NAME:
        logError('Cannot guess user name for the User Service! Exiting!')
        exit(1)

    try:
        open(LOG_FILE, 'w').close()
    except Exception:
        print 'Cannot reset log!!'

    logInfo('User Service: Starting...')

    USER_HOME = subprocess.check_output('echo ~' + USER_NAME, shell=True).strip().rstrip('/')

    th_s = ThreadedServer(UserService, port=int(PORT[0]), protocol_config=CONFIG, listener_timeout=1)
    th_s.start()

    logInfo('User Service: Bye bye.')
github brandon-rhodes / fopnp / py3 / chapter18 / rpyc_server.py View on Github external
def main():
    from rpyc.utils.server import ThreadedServer
    t = ThreadedServer(MyService, port = 18861)
    t.start()
github stroucki / tashi / src / tashi / clustermanager / clustermanager.py View on Github external
dfs = instantiateImplementation(config.get("ClusterManager", "dfs"), config)
	data = instantiateImplementation(config.get("ClusterManager", "data"), config)
	service = instantiateImplementation(config.get("ClusterManager", "service"), config, data, dfs)

	if boolean(config.get("Security", "authAndEncrypt")):
		users = {}
		userDatabase = data.getUsers()
		for user in userDatabase.values():
			if user.passwd != None:
				users[user.name] = user.passwd
		users[config.get('AllowedUsers', 'nodeManagerUser')] = config.get('AllowedUsers', 'nodeManagerPassword')
		users[config.get('AllowedUsers', 'agentUser')] = config.get('AllowedUsers', 'agentPassword')
		authenticator = TlsliteVdbAuthenticator.from_dict(users)
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False, authenticator=authenticator)
	else:
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False)
	t.logger.setLevel(logging.ERROR)
	t.service.service = service
	t.service._type = 'ClusterManagerService'

	debugConsole(globals())
	
	try:
		t.start()
	except KeyboardInterrupt:
		handleSIGTERM(signal.SIGTERM, None)
github hugsy / stuff / ida_scripts / ida_rpyc_server.py View on Github external
def start():
    global g_IdaServer
    if DEBUG:
        s = rpyc.utils.server.OneShotServer(g_IdaServer, hostname=HOST, port=PORT)
    else:
        s = rpyc.utils.server.ThreadedServer(g_IdaServer, hostname=HOST, port=PORT)
    ok(" starting server...")
    s.start()
    s.close()
    ok("server closed")
    return
github apache / tashi / trunk / src / tashi / clustermanager / clustermanager.py View on Github external
if boolean(config.get("Security", "authAndEncrypt")):
		users = {}
		userDatabase = data.getUsers()
		for user in userDatabase.values():
			if user.passwd != None:
				users[user.name] = user.passwd
		users[config.get('AllowedUsers', 'nodeManagerUser')] = config.get('AllowedUsers', 'nodeManagerPassword')
		users[config.get('AllowedUsers', 'agentUser')] = config.get('AllowedUsers', 'agentPassword')
		try:
			authenticator = VdbAuthenticator.from_dict(users)
		except:
			authenticator = TlsliteVdbAuthenticator.from_dict(users)
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False, authenticator=authenticator)
	else:
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False)
	t.logger.quiet = True
	t.service.service = service
	t.service._type = 'ClusterManagerService'

	debugConsole(globals())
	
	try:
		t.start()
	except KeyboardInterrupt:
		handleSIGTERM(signal.SIGTERM, None)
github stroucki / tashi / src / tashi / clustermanager / clustermanager.py View on Github external
global service, data
	
	dfs = instantiateImplementation(config.get("ClusterManager", "dfs"), config)
	data = instantiateImplementation(config.get("ClusterManager", "data"), config)
	service = instantiateImplementation(config.get("ClusterManager", "service"), config, data, dfs)

	if boolean(config.get("Security", "authAndEncrypt")):
		users = {}
		userDatabase = data.getUsers()
		for user in userDatabase.values():
			if user.passwd != None:
				users[user.name] = user.passwd
		users[config.get('AllowedUsers', 'nodeManagerUser')] = config.get('AllowedUsers', 'nodeManagerPassword')
		users[config.get('AllowedUsers', 'agentUser')] = config.get('AllowedUsers', 'agentPassword')
		authenticator = TlsliteVdbAuthenticator.from_dict(users)
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False, authenticator=authenticator)
	else:
		t = ThreadedServer(service=rpycservices.ManagerService, hostname='0.0.0.0', port=int(config.get('ClusterManagerService', 'port')), auto_register=False)
	t.logger.setLevel(logging.ERROR)
	t.service.service = service
	t.service._type = 'ClusterManagerService'

	debugConsole(globals())
	
	try:
		t.start()
	except KeyboardInterrupt:
		handleSIGTERM(signal.SIGTERM, None)
github sccn / SNAP / src / modules / LSE / LSE_GameClient.py View on Github external
taskMgr.add(self.update_joystick,'update_joystick')
            print "Initialized joystick."
        except:
            print "Warning: no joystick found!"

        # init speech control
        if self.allow_speech:
            try:
                # removed the unused speech commands to reduce the chance of mis-detection
                # framework.speech_io.speech.listenfor(['yes','no','skip','report','red','green','blue','yellow','north','south','east','west','front','back','center','left','right','alpha move here','bravo move here','alpha move in front of me','bravo move in front of me','alpha move to truck','bravo move to truck','alpha move behind me','bravo move behind me','alpha move to my left','bravo move to my left','alpha move to my right','bravo move to my right','suspicious object','unclear'],self.on_speech)
                framework.speech_io.speech.listenfor(['yes','no','skip','report','red','green','blue','yellow','north','south','east','west','front','back','center','left','right','suspicious object','unclear'],self.on_speech)
            except:
                print "Could not initialiate speech control; falling back to touch screen only."
            
        # initiate a server thread that listens for remote commands
        self.remote_server = rpyc.utils.server.ThreadedServer(MainService,port=self.client_port)
        self.remote_thread = threading.Thread(target=self.remote_server.start)
        self.remote_thread.setDaemon(True)
        self.remote_thread.start()

        # sleep forever, keeping the engine running in the background
        self.sleep(100000)
github tomerfiliba / rpyc / demos / web8 / server.py View on Github external
btn3.connect("clicked", on_btn3_clicked)
        btn3.show()
        self.content.pack_start(btn3)

        lbl3 = self.gtk.Label("Server time is: ?")
        lbl3.show()
        self.content.pack_start(lbl3)

    def page_hello_world(self):
        lbl = self.gtk.Label("Hello world!")
        lbl.show()
        self.content.pack_start(lbl)


if __name__ == "__main__":
    t = ThreadedServer(Web8Service, port=18833)
    t.start()