本文整理汇总了Python中rpyc.utils.server.ThreadedServer方法的典型用法代码示例。如果您正苦于以下问题:Python server.ThreadedServer方法的具体用法?Python server.ThreadedServer怎么用?Python server.ThreadedServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rpyc.utils.server
的用法示例。
在下文中一共展示了server.ThreadedServer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_daemon
# 需要导入模块: from rpyc.utils import server [as 别名]
# 或者: from rpyc.utils.server import ThreadedServer [as 别名]
def start_daemon(port=DEFAULT_PORT):
try:
from ..logic import GlobalInfo
GlobalInfo.daemon_inst = SingleInstance()
except SingleInstanceException:
return
# load plugins in headless mode
from ..plugins import PluginManager
GlobalInfo.headless_plugin_manager = PluginManager(None)
GlobalInfo.headless_plugin_manager.discover_and_initialize_plugins()
# start the server
server = ThreadedServer(ManagementService, port=port, protocol_config={'allow_public_attrs': True})
threading.Thread(target=monitor_thread, args=(server, ), daemon=True).start()
server.start()
示例2: get_server
# 需要导入模块: from rpyc.utils import server [as 别名]
# 或者: from rpyc.utils.server import ThreadedServer [as 别名]
def get_server(listen_config, scheduler, SchedulerServiceClass=None):
# 额外构造函数参数
ser_args = ['test args']
ser_kwargs = {}
# 传递Service构造函数参数
SSC = SchedulerServiceClass if SchedulerServiceClass is not None else SchedulerService
service = classpartial(SSC, scheduler, *ser_args, **ser_kwargs)
# 允许属性访问
protocol_config = {'allow_public_attrs': True}
# 实例化RPYC服务器
server = ThreadedServer(service, protocol_config=protocol_config, **listen_config)
return server
示例3: server_launch
# 需要导入模块: from rpyc.utils import server [as 别名]
# 或者: from rpyc.utils.server import ThreadedServer [as 别名]
def server_launch(service, ip, port, config):
"""
Target for the multiprocessing Pycryptoki service.
:param service:
:param ip:
:param port:
:param config:
:return:
"""
t = ThreadedServer(service, hostname=ip, port=port, protocol_config=config)
t.start()
示例4: remote_service_operator
# 需要导入模块: from rpyc.utils import server [as 别名]
# 或者: from rpyc.utils.server import ThreadedServer [as 别名]
def remote_service_operator(DATA):
"""
starts the (threaded) service which exposes the
RPYC_service factory class to remote RPYC clients.
This is the function which should be called in the main function,
there is no need for hiding it in a class.
"""
CS = CustomizedService(DATA)
t = ThreadedServer(CS, port = DATA.localhost.port)#, protocol_config = {"allow_public_attrs" : True})
t.start()