From dbef2ec3afb47339830448db113769ea33682820 Mon Sep 17 00:00:00 2001 From: Angus Jelinek Date: Thu, 19 Dec 2024 10:23:50 -0800 Subject: [PATCH] remove unused slot --- python/langsmith/_internal/_background_thread.py | 4 ++-- python/langsmith/client.py | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/python/langsmith/_internal/_background_thread.py b/python/langsmith/_internal/_background_thread.py index e2fdb2bda..ae98101f8 100644 --- a/python/langsmith/_internal/_background_thread.py +++ b/python/langsmith/_internal/_background_thread.py @@ -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 ) @@ -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 diff --git a/python/langsmith/client.py b/python/langsmith/client.py index d45919697..600f4d1aa 100644 --- a/python/langsmith/client.py +++ b/python/langsmith/client.py @@ -396,8 +396,7 @@ class Client: "_manual_cleanup", "_pyo3_client", "compress_traces", - "boundary", - "compressor", + "_boundary", "compressor_writer", "_run_count", "_buffer_lock", @@ -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 @@ -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() @@ -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", } @@ -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()