当前位置: 首页>>代码示例>>Python>>正文


Python BaseManager.__init__方法代码示例

本文整理汇总了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
开发者ID:wonderkun,项目名称:spider,代码行数:32,代码来源:server.py

示例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)
开发者ID:wayne0429,项目名称:Study,代码行数:10,代码来源:task_master.py

示例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()
开发者ID:nihilus,项目名称:toolbag,代码行数:14,代码来源:agentmanager.py

示例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)
开发者ID:Schille,项目名称:MagneticPendulum,代码行数:14,代码来源:ClusterQueueManager.py

示例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
开发者ID:sabago,项目名称:pysph,代码行数:20,代码来源:solver_interfaces.py

示例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()
开发者ID:IDA-RE-things,项目名称:toolbag,代码行数:22,代码来源:agentmanager.py

示例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)
开发者ID:wonderkun,项目名称:spider,代码行数:43,代码来源:slave.py

示例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)
开发者ID:gauteh,项目名称:sonobuoy-gautebuoy,代码行数:4,代码来源:ui.py

示例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)
开发者ID:hasjan,项目名称:crawler,代码行数:6,代码来源:queue_manager.py

示例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()
开发者ID:sabago,项目名称:pysph,代码行数:6,代码来源:solver_interfaces.py

示例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()
开发者ID:MyMindMyBodyMySoul,项目名称:crawler,代码行数:7,代码来源:queue_manager.py

示例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
开发者ID:wayne0429,项目名称:Study,代码行数:8,代码来源:task_worker.py

示例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")
开发者ID:freifunk-darmstadt,项目名称:TestFramework,代码行数:4,代码来源:ipc.py

示例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)
开发者ID:effy,项目名称:effyTableDB,代码行数:6,代码来源:effyTable.py


注:本文中的multiprocessing.managers.BaseManager.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。