本文整理汇总了Python中multiprocessing.managers.BaseManager.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BaseManager.__init__方法的具体用法?Python BaseManager.__init__怎么用?Python BaseManager.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.managers.BaseManager
的用法示例。
在下文中一共展示了BaseManager.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self,address='127.0.0.1',port=6666,authkey='',rootDomain='',digSubDomain=False,threads_num=1):
BaseManager.__init__(self,(address,int(port)),authkey)
task_queue_n=Queue.Queue()
response_queue_n=Queue.Queue()
# self.address=address
self.port=port
self.authkey=authkey
self.register('task_queue_n',callable=lambda:task_queue_n)
self.register('response_queue_n',callable=lambda:response_queue_n)
# self.tasks=[] #记录自己已经访问过的域名,或者路径
self.digSubDomain=digSubDomain
self.DnsThread=None
self.httpserverThread=None
self.START_FLAG=True
self.count=0 #访问错误计数
self.delay=0 #延时时间
self.threads_num=threads_num #爆破子域名的线程数
if self.digSubDomain:
self.domain=domainRecorder(rootDomain=rootDomain,domain=rootDomain,path='/',isSubDomain=True)
else:
self.domain=domainRecorder(rootDomain=rootDomain,domain=rootDomain,path='/',isSubDomain=False)
self.domainCount=0
示例2: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address=None, authkey=None, serialize='pickle',
ctx=None):
BaseManager.__init__(self, address, authkey, serialize, ctx)
self.task_queue, self.result_queue = None, None
# callable使用lambda报错
self.register('get_task_queue', callable=return_task_queue)
self.register('get_result_queue', callable=return_result_queue)
示例3: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address, authkey):
BaseManager.__init__(self, address, authkey)
self.srvAddr = address
self.srvKey = authkey
AgentManager.register("get")
AgentManager.register("load")
AgentManager.register("readFile")
AgentManager.register("writeFile")
AgentManager.register("printmsg")
self.localattrs = dict()
示例4: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self):
BaseManager.__init__(self,address=(Parameter.SERVER, Parameter.PORT), authkey=Parameter.PASSWORD)
self._manager = Manager()
self._coordinates = self._manager.Queue()
self._values = self._manager.Queue()
self._lock = self._manager.Lock()
self._clientCounter = self._manager.Value('i', 0)
self.register('clientStart', self.addClient)
self.register('clientDone', self.removeClient)
self.register('getCoordinatesLock', self.getCoordinatesLock)
self.register('getCoordinatesQueue', self.getCoordinates)
self.register('getValuesQueue', self.getValues)
示例5: start
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def start(self, controller):
self.controller = controller
self.register('get_controller', self.get_controller)
if not self.try_next_port:
self.get_server().serve_forever()
host, port = self.address
while self.try_next_port:
try:
BaseManager.__init__(self, (host,port), self.authkey)
self.get_server().serve_forever()
self.try_next_port = False
except socket.error as e:
try_next_port = False
import errno
if e.errno == errno.EADDRINUSE:
port += 1
else:
raise
示例6: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address, authkey):
BaseManager.__init__(self, address, authkey)
self.agentData = address[0], address[1], authkey
self.srvAddr = address
self.srvKey = authkey
# remoteTask is task object remotely instantiated in the agent
self.remoteTask = None
# toolbagTask is toolbag's local copy
self.toolbagTask = None
AgentManager.register("get")
AgentManager.register("load")
AgentManager.register("readFile")
AgentManager.register("writeFile")
AgentManager.register("printmsg")
self.localattrs = dict()
示例7: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self,thread_size=0,server_addr='127.0.0.1',server_port=6666,authkey=b'123456',lock=None,count=10):
threading.Thread.__init__(self) #初始化父类
BaseManager.__init__(self,address=(server_addr,server_port), authkey=authkey)
self.visited=None #访问过的集合
self.pages=None #采集到的页面
self.threads=[] #存储每个线程
self.wait_queue=Queue.Queue() #正在等待的任务组成的队列
self.lock=lock #设置线程锁
# 为实现任务管理设置的标志位
self.start_flag = False
self.is_running = False
self.finished_all = False
self.dead_all = False
self.Runable=True #
self.thread_size=thread_size #设置线程的个数
self.task_num=self.thread_size*2 # 设置任务队列的大小
'''
初始化服务器连接模块
'''
self.server_addr=server_addr
self.server_port=server_port
self.authkey=authkey
self.register('task_queue_n')
self.register('response_queue_n')
self.__count=count #尝试连接服务器的次数
print'[%s] [INFO] Connect to server %s...' %(self.__time(),server_addr)
try:
self.connect()
except Exception,e:
print "[%s] [ERROR] Connect to server error , please confirm ip,port and authkey ..."%(self.__time())
exit(0)
示例8: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__ (self):
BaseManager.__init__ (self, address = ('127.0.0.1', 50002), authkey = self.AUTHKEY)
示例9: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self):
self.register('queue_manager', callable=QueueManager())
BaseManager.__init__(self, address=(settings.SERVER_ADDRESS, settings.SERVER_PORT),
authkey=settings.SERVER_AUTH)
示例10: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address=None, authkey=None, serializer='pickle', start=True):
BaseManager.__init__(self, address, authkey, serializer)
if start:
self.start()
示例11: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self):
self.register('host_queue')
self.register('result_queue')
BaseManager.__init__(self, address=(host, port), authkey=authkey)
self.connect()
示例12: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address=None, authkey=None, serialize='pickle',
ctx=None):
BaseManager.__init__(self, address, authkey, serialize, ctx)
self.register('get_task_queue')
self.register('get_result_queue')
self.rq, self.tq = None, None
示例13: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self):
BaseManager.__init__(self, address=("localhost", 5000), authkey=b"abc42")
示例14: __init__
# 需要导入模块: from multiprocessing.managers import BaseManager [as 别名]
# 或者: from multiprocessing.managers.BaseManager import __init__ [as 别名]
def __init__(self, address, authkey):
self.__address = address
self.__authkey = authkey
BaseManager.__init__(self, address, authkey)