Ejemplo n.º 1
0
 def __init__(self, partitions, address=get_zerorpc_address(port=get_open_port())):
     self.partitions = partitions
     self.address = address
     self.server = zerorpc.Server(self)
     self.server.bind(self.address)
     self.thread = gevent.spawn(self.server.run)
     logger.info("Job server started at " + self.address)
Ejemplo n.º 2
0
 def __init__(self):
     super(PartitionServer, self).__init__(name='Spark.PartitionServer')
     self.ip = get_my_ip()
     self.port = get_open_port()
     self.address = get_zerorpc_address(port=self.port)
     self.partitions = {}  # uuid => service
     self.handler = PartitionServerHandler(self.partitions, address=self.address)
     atexit.register(lambda: self.__del__())
Ejemplo n.º 3
0
 def __init__(self):
     super(WorkerServer, self).__init__('Spark.WorkerServer')
     self.uuid = str(uuid.uuid4())
     self.ip = get_my_ip()
     self.port = get_open_port()
     self.address = get_zerorpc_address(port=self.port)
     self.service = Service(type=_WORKER_CASTER_TYPE, name=self.uuid, location=self.ip, port=self.port)
     self.add(self.service)
Ejemplo n.º 4
0
 def __init__(self, services, address=get_zerorpc_address(port=get_open_port())):
     self.services = services
     self.address = address
     self.server = zerorpc.Server(self)
     self.server.bind(self.address)
     self.thread = gevent.spawn(self.server.run)
     logger.info("Job server started at " + self.address)
     self.lock = threading.Lock()
Ejemplo n.º 5
0
 def __init__(self, aname, stype, sname, location, port, addr):
     super(ServiceAt, self).__init__(aname=aname, stype=stype, sname=sname,
                                     location=location, port=port, addr=addr,
                                     type=stype, uuid=sname, address=get_zerorpc_address(addr, port))
Ejemplo n.º 6
0
 def __init__(self, stype, port, sname='', location=''):
     super(Service, self).__init__(stype=stype, sname=sname, location=location, port=_compat_str(port),
                                   type=stype, uuid=sname, address=get_zerorpc_address(location, _compat_str(port)))