本文整理汇总了Python中multiprocessing.managers.BaseManager.get_server方法的典型用法代码示例。如果您正苦于以下问题:Python BaseManager.get_server方法的具体用法?Python BaseManager.get_server怎么用?Python BaseManager.get_server使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.managers.BaseManager
的用法示例。
在下文中一共展示了BaseManager.get_server方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
def run(self):
while not self.is_stop:
mgr = BaseManager(address=('', 7777), authkey='xxx')
s = mgr.get_server()
s.serve_forever()
i = 1
i += 1
示例2: make_simple_server_manager
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
def make_simple_server_manager(ip,port, authkey):
print "starting server..."
manager = BaseManager(address=('', 50000), authkey='abc')
server = manager.get_server()
server.serve_forever()
print "started"
return manager
示例3: SharedManager
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
class SharedManager(object):
def __init__(self, addr, auth_key=''):
self.manager = BaseManager(address=addr, authkey=auth_key)
self.server = None
def register(self, plugin, clazz, methods):
self.manager.register(plugin, clazz, exposed=methods)
def get_manager(self):
return self.manager
def get_server(self):
return self.server
def start(self):
try:
self.server = self.manager.get_server()
self.server.serve_forever()
except:
traceback.print_exc()
示例4: len
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
#
# Copyright 2010 Toshio Koide.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from effyTable import effyTable
from multiprocessing.managers import BaseManager
import sys
if len(sys.argv) < 3:
print "usage: %s <address> <port> <authkey>" % sys.argv[0]
exit(1)
[address, port, authkey] = sys.argv[1:]
t = effyTable()
BaseManager.register('gettable', callable=lambda:t)
m = BaseManager(address=(address, int(port)), authkey=authkey)
m.get_server().serve_forever()
示例5: BaseManager
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
import core,sys
if core.initialiser() != core.STATUS_INITIALIZED:
print "Erreur d'initialisation du module core"
sys.exit(1)
else:
print core.STATUS
import multiprocessing
from multiprocessing.managers import BaseManager
BaseManager.register('pluginManager', callable=lambda:core.PLUGIN_MANAGER)
BaseManager.register('downloadManager', callable=lambda:core.DOWNLOAD_MANAGER)
BaseManager.register('historique', callable=lambda:core.HISTORIQUE)
manager = BaseManager(core.SHARED_OBJECT_ADDRESS, core.SHARED_OBJECT_AUTHKEY)
server = manager.get_server()
print "Démon lancé..."
server.serve_forever()
示例6: start_server
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
def start_server(port, password, ip=''):
logger.info('*** Base Manager Server daemon starting at: ' + datetime.now().strftime('%Y-%m-%d %H:%M:%S') + ' ***')
mgr = BaseManager(address=(ip, port), authkey=password)
s = mgr.get_server()
s.serve_forever()
示例7: main
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import get_server [as 别名]
def main():
BaseManager.register("run_rpc_function", some_function)
manager = BaseManager(address=("127.0.0.1", 51999), authkey="my_authkey")
service = manager.get_server()
service.serve_forever()