Skip to content

Commit

Permalink
specify bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwoods2 committed Nov 28, 2024
1 parent 92953c6 commit 977898d
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions imdclient/IMDClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IMDClient:
socket_bufsize : int, (optional)
Size of the socket buffer in bytes. Default is to use the system default
buffer_size : int (optional)
IMDFramebuffer will be filled with as many :class:`IMDFrame` fit in `buffer_size` [``10MB``]
IMDFramebuffer will be filled with as many :class:`IMDFrame` fit in `buffer_size` bytes [``10MB``]
**kwargs : dict (optional)
Additional keyword arguments to pass to the :class:`BaseIMDProducer` and :class:`IMDFrameBuffer`
"""
Expand Down Expand Up @@ -146,9 +146,7 @@ def _connect_to_server(self, host, port, socket_bufsize):
# /proc/sys/net/core/rmem_default
# Max (linux):
# /proc/sys/net/core/rmem_max
conn.setsockopt(
socket.SOL_SOCKET, socket.SO_RCVBUF, socket_bufsize
)
conn.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, socket_bufsize)
try:
logger.debug(f"IMDClient: Connecting to {host}:{port}")
conn.connect((host, port))
Expand Down Expand Up @@ -682,9 +680,7 @@ def __init__(
raise ValueError("pause_empty_proportion must be between 0 and 1")
self._pause_empty_proportion = pause_empty_proportion
if unpause_empty_proportion < 0 or unpause_empty_proportion > 1:
raise ValueError(
"unpause_empty_proportion must be between 0 and 1"
)
raise ValueError("unpause_empty_proportion must be between 0 and 1")
self._unpause_empty_proportion = unpause_empty_proportion

if buffer_size <= 0:
Expand Down Expand Up @@ -751,9 +747,7 @@ def wait_for_space(self):
logger.debug("IMDProducer: Noticing consumer finished")
raise EOFError
except Exception as e:
logger.debug(
f"IMDProducer: Error waiting for space in buffer: {e}"
)
logger.debug(f"IMDProducer: Error waiting for space in buffer: {e}")

def pop_empty_imdframe(self):
logger.debug("IMDProducer: Getting empty frame")
Expand Down Expand Up @@ -799,9 +793,7 @@ def pop_full_imdframe(self):
imdf = self._full_q.get()
else:
with self._full_imdf_avail:
while (
self._full_q.qsize() == 0 and not self._producer_finished
):
while self._full_q.qsize() == 0 and not self._producer_finished:
self._full_imdf_avail.wait()

if self._producer_finished and self._full_q.qsize() == 0:
Expand Down

0 comments on commit 977898d

Please sign in to comment.