本文整理汇总了Python中zmq.RCVHWM属性的典型用法代码示例。如果您正苦于以下问题:Python zmq.RCVHWM属性的具体用法?Python zmq.RCVHWM怎么用?Python zmq.RCVHWM使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类zmq
的用法示例。
在下文中一共展示了zmq.RCVHWM属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_hwm
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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)
示例2: get_hwm
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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)
示例3: set_hwm
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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)
示例4: createZMQSocket
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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
示例5: __init__
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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)
示例6: set_hwm
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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)
示例7: init_communication
# 需要导入模块: import zmq [as 别名]
# 或者: from zmq import RCVHWM [as 别名]
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}")