def __init__(self, coroutine, sock_job_for_me_port, name=None, connections=None, main_connection_name=None): """ Parameters ---------- coroutine : Class instance that contains init, run and finish methods sock_job_for_me_port: str Port number for input socket url name: str Stage name main_connection_name : str Default next step name. Used to send data when destination is not provided connections: dict {'STEP_NANE' : (zmq STEP_NANE port in)} Port number for socket for each next steps """ Process.__init__(self) Component.__init__(self, parent=None) self.name = name Connections.__init__(self, main_connection_name, connections) self.coroutine = coroutine self.sock_job_for_me_url = 'tcp://localhost:' + sock_job_for_me_port self.done = False self.waiting_since = Value('i', 0) self._nb_job_done = Value('i', 0) self._stop = Value('i', 0) self._running = Value('i', 0)
def __init__(self, coroutine, name, main_connection_name, connections=None): """ Parameters ---------- coroutine : Class instance It contains init, run and finish methods name: str Producer name main_connection_name : str Default next step name. Used to send data when destination is not provided connections: dict {'STEP_NANE' : (zmq STEP_NANE port in)} Port number for socket for each next steps """ Process.__init__(self) Component.__init__(self, parent=None) self.name = name Connections.__init__(self, main_connection_name, connections) self.coroutine = coroutine self.other_requests = dict() self._nb_job_done = Value('i', 0) self._running = Value('i', 0) self.done = False
def __init__( self, coroutine, sock_job_for_me_port, name=None, connections=None, main_connection_name=None): """ Parameters ---------- coroutine : Class instance that contains init, run and finish methods sock_job_for_me_port: str Port number for input socket url name: str Stage name main_connection_name : str Default next step name. Used to send data when destination is not provided connections: dict {'STEP_NANE' : (zmq STEP_NANE port in)} Port number for socket for each next steps """ Process.__init__(self) Component.__init__(self,parent=None) self.name = name Connections.__init__(self, main_connection_name, connections) self.coroutine = coroutine self.sock_job_for_me_url = 'tcp://localhost:' + sock_job_for_me_port self.done = False self.waiting_since = Value('i',0) self._nb_job_done = Value('i',0) self._stop = Value('i',0) self._running = Value('i',0)
def init_connections(self): """ Initialise zmq sockets. Because this class is s Process, This method must be call in the run method to be hold by the correct process. """ self.context = zmq.Context() Connections.init_connections(self) return True
def init_connections(self): """ Initialise zmq sockets. Because this class is s Process, This method must be call in the run method to be hold by the correct process. """ Connections.init_connections(self) context = Context() self.sock_for_me = context.socket(REQ) self.sock_for_me.connect(self.sock_job_for_me_url) # Use a ZMQ Pool to get multichannel message self.poll = Poller() # Register sockets self.poll.register(self.sock_for_me, POLLIN) # Send READY to next_router to inform about my capacity to compute new # job self.sock_for_me.send_pyobj("READY") return True
def __init__(self, coroutine, name, main_connection_name, connections=None): """ Parameters ---------- coroutine : Class instance It contains init, run and finish methods name: str Producer name main_connection_name : str Default next step name. Used to send data when destination is not provided connections: dict {'STEP_NANE' : (zmq STEP_NANE port in)} Port number for socket for each next steps """ Process.__init__(self) Component.__init__(self,parent=None) self.name = name Connections.__init__(self, main_connection_name, connections) self.coroutine = coroutine self.other_requests=dict() self._nb_job_done = Value('i',0) self._running = Value('i',0) self.done = False