本文整理匯總了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()