Python zmq.RCVHWM Examples
The following are 11
code examples of zmq.RCVHWM().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
zmq
, or try the search function
.
Example #1
Source File: socket.py From vnpy_crypto with MIT License | 6 votes |
def get_hwm(self): """Get the High Water Mark. On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM """ major = zmq.zmq_version_info()[0] if major >= 3: # return sndhwm, fallback on rcvhwm try: return self.getsockopt(zmq.SNDHWM) except zmq.ZMQError: pass return self.getsockopt(zmq.RCVHWM) else: return self.getsockopt(zmq.HWM)
Example #2
Source File: socket.py From Computable with MIT License | 6 votes |
def get_hwm(self): """get the High Water Mark On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM """ major = zmq.zmq_version_info()[0] if major >= 3: # return sndhwm, fallback on rcvhwm try: return self.getsockopt(zmq.SNDHWM) except zmq.ZMQError as e: pass return self.getsockopt(zmq.RCVHWM) else: return self.getsockopt(zmq.HWM)
Example #3
Source File: socket.py From Computable with MIT License | 6 votes |
def set_hwm(self, value): """set the High Water Mark On libzmq ≥ 3, this sets both SNDHWM and RCVHWM """ major = zmq.zmq_version_info()[0] if major >= 3: raised = None try: self.sndhwm = value except Exception as e: raised = e try: self.rcvhwm = value except Exception: raised = e if raised: raise raised else: return self.setsockopt(zmq.HWM, value)
Example #4
Source File: scoopzmq.py From scoop with GNU Lesser General Public License v3.0 | 6 votes |
def createZMQSocket(self, sock_type): """Create a socket of the given sock_type and deactivate message dropping""" sock = self.ZMQcontext.socket(sock_type) sock.setsockopt(zmq.LINGER, LINGER_TIME) sock.setsockopt(zmq.IPV4ONLY, 0) # Remove message dropping sock.setsockopt(zmq.SNDHWM, 0) sock.setsockopt(zmq.RCVHWM, 0) try: sock.setsockopt(zmq.IMMEDIATE, 1) except: # This parameter was recently added by new libzmq versions pass # Don't accept unroutable messages if sock_type == zmq.ROUTER: sock.setsockopt(zmq.ROUTER_MANDATORY, 1) return sock
Example #5
Source File: socket.py From pySINDy with MIT License | 6 votes |
def get_hwm(self): """Get the High Water Mark. On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM """ major = zmq.zmq_version_info()[0] if major >= 3: # return sndhwm, fallback on rcvhwm try: return self.getsockopt(zmq.SNDHWM) except zmq.ZMQError: pass return self.getsockopt(zmq.RCVHWM) else: return self.getsockopt(zmq.HWM)
Example #6
Source File: socket.py From Carnets with BSD 3-Clause "New" or "Revised" License | 6 votes |
def get_hwm(self): """Get the High Water Mark. On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM """ major = zmq.zmq_version_info()[0] if major >= 3: # return sndhwm, fallback on rcvhwm try: return self.getsockopt(zmq.SNDHWM) except zmq.ZMQError: pass return self.getsockopt(zmq.RCVHWM) else: return self.getsockopt(zmq.HWM)
Example #7
Source File: cig_olt_zmq.py From voltha with Apache License 2.0 | 6 votes |
def __init__(self, ip_address, rx_incoming_queue): self.external_conn = "tcp://{}:{}".format(ip_address, _OLTD_ZEROMQ_PUB_OTHER_PORT) self.socket = zmq_context.socket(zmq.SUB) self.socket.setsockopt(zmq.SUBSCRIBE,'') self.socket.setsockopt(zmq.RCVHWM,10000) self.socket.setsockopt(zmq.RCVTIMEO,1000) self.socket.connect(self.external_conn) self.rx_incoming_queue = rx_incoming_queue self.killflag = 0 log.info('CigZmqClientSub zmq.RCVHWM', self.socket.getsockopt(zmq.RCVHWM)) try: thread.start_new_thread(self.sub_receive,()) except: log.exception(e.message)
Example #8
Source File: socket.py From vnpy_crypto with MIT License | 5 votes |
def set_hwm(self, value): """Set the High Water Mark. On libzmq ≥ 3, this sets both SNDHWM and RCVHWM .. warning:: New values only take effect for subsequent socket bind/connects. """ major = zmq.zmq_version_info()[0] if major >= 3: raised = None try: self.sndhwm = value except Exception as e: raised = e try: self.rcvhwm = value except Exception as e: raised = e if raised: raise raised else: return self.setsockopt(zmq.HWM, value)
Example #9
Source File: worker.py From rl_algorithms with MIT License | 5 votes |
def init_communication(self): """Initialize sockets connecting worker-learner, worker-buffer.""" # for receiving params from learner ctx = zmq.Context() self.sub_socket = ctx.socket(zmq.SUB) self.sub_socket.setsockopt_string(zmq.SUBSCRIBE, "") self.sub_socket.setsockopt(zmq.RCVHWM, 2) self.sub_socket.connect(f"tcp://127.0.0.1:{self.comm_cfg.learner_worker_port}") # for sending replay data to buffer self.push_socket = ctx.socket(zmq.PUSH) self.push_socket.connect(f"tcp://127.0.0.1:{self.comm_cfg.worker_buffer_port}")
Example #10
Source File: socket.py From pySINDy with MIT License | 5 votes |
def set_hwm(self, value): """Set the High Water Mark. On libzmq ≥ 3, this sets both SNDHWM and RCVHWM .. warning:: New values only take effect for subsequent socket bind/connects. """ major = zmq.zmq_version_info()[0] if major >= 3: raised = None try: self.sndhwm = value except Exception as e: raised = e try: self.rcvhwm = value except Exception as e: raised = e if raised: raise raised else: return self.setsockopt(zmq.HWM, value)
Example #11
Source File: socket.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_hwm(self, value): """Set the High Water Mark. On libzmq ≥ 3, this sets both SNDHWM and RCVHWM .. warning:: New values only take effect for subsequent socket bind/connects. """ major = zmq.zmq_version_info()[0] if major >= 3: raised = None try: self.sndhwm = value except Exception as e: raised = e try: self.rcvhwm = value except Exception as e: raised = e if raised: raise raised else: return self.setsockopt(zmq.HWM, value)