Skip to content

Commit

Permalink
remove unused slot
Browse files Browse the repository at this point in the history
  • Loading branch information
angus-langchain committed Dec 19, 2024
1 parent 35d46ed commit dbef2ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/langsmith/_internal/_background_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
logger = logging.getLogger("langsmith.client")

HTTP_REQUEST_THREAD_POOL = concurrent.futures.ThreadPoolExecutor(
max_workers=cpu_count()*3
max_workers=cpu_count() * 3
)


Expand Down Expand Up @@ -119,7 +119,7 @@ def _tracing_thread_drain_compressed_buffer(
return None

# Write final boundary and close compression stream
client.compressor_writer.write(f"--{client.boundary}--\r\n".encode())
client.compressor_writer.write(f"--{client._boundary}--\r\n".encode())
client.compressor_writer.close()

filled_buffer = client.compressed_runs_buffer
Expand Down
11 changes: 5 additions & 6 deletions python/langsmith/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ class Client:
"_manual_cleanup",
"_pyo3_client",
"compress_traces",
"boundary",
"compressor",
"_boundary",
"compressor_writer",
"_run_count",
"_buffer_lock",
Expand Down Expand Up @@ -508,7 +507,7 @@ def __init__(
self.compress_traces = ls_utils.get_env_var("USE_RUN_COMPRESSION")
if self.compress_traces:
self._futures: set[cf.Future] = set()
self.boundary = BOUNDARY
self._boundary = BOUNDARY
self.compressed_runs_buffer: Optional[io.BytesIO] = io.BytesIO()
self.compressor_writer: zstd.ZstdCompressionWriter = zstd.ZstdCompressor(
level=3, threads=-1
Expand Down Expand Up @@ -1335,7 +1334,7 @@ def create_run(
)
with self._buffer_lock:
compress_multipart_parts_and_context(
multipart_form, self.compressor_writer, self.boundary
multipart_form, self.compressor_writer, self._boundary
)
self._run_count += 1
self._data_available_event.set()
Expand Down Expand Up @@ -1730,7 +1729,7 @@ def _send_compressed_multipart_req(self, data_stream, *, attempts: int = 3):
headers = {
**self._headers,
"X-API-KEY": api_key,
"Content-Type": f"multipart/form-data; boundary={self.boundary}",
"Content-Type": f"multipart/form-data; boundary={self._boundary}",
"Content-Encoding": "zstd",
}

Expand Down Expand Up @@ -1865,7 +1864,7 @@ def update_run(
)
with self._buffer_lock:
compress_multipart_parts_and_context(
multipart_form, self.compressor_writer, self.boundary
multipart_form, self.compressor_writer, self._boundary
)
self._run_count += 1
self._data_available_event.set()
Expand Down

0 comments on commit dbef2ec

Please sign in to comment.