mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
style: black format uploader.py
This commit is contained in:
parent
ecfeebc79c
commit
d2ecce7529
1 changed files with 12 additions and 4 deletions
|
|
@ -204,23 +204,31 @@ class Uploader:
|
|||
while len(gz_buffer) >= _GCS_CHUNK_SIZE:
|
||||
chunk = bytes(gz_buffer[:_GCS_CHUNK_SIZE])
|
||||
gz_buffer = gz_buffer[_GCS_CHUNK_SIZE:]
|
||||
await self._put_chunk(session_uri, chunk, offset=offset, final=False)
|
||||
await self._put_chunk(
|
||||
session_uri, chunk, offset=offset, final=False
|
||||
)
|
||||
offset += len(chunk)
|
||||
|
||||
if not has_data:
|
||||
verbose_proxy_logger.debug("uploader: no data to stream, skipping upload")
|
||||
verbose_proxy_logger.debug(
|
||||
"uploader: no data to stream, skipping upload"
|
||||
)
|
||||
return 0
|
||||
|
||||
gz.close()
|
||||
gz_buffer.extend(raw_buf.getvalue())
|
||||
total = offset + len(gz_buffer)
|
||||
await self._put_chunk(session_uri, bytes(gz_buffer), offset=offset, final=True)
|
||||
await self._put_chunk(
|
||||
session_uri, bytes(gz_buffer), offset=offset, final=True
|
||||
)
|
||||
|
||||
except Exception:
|
||||
# Cancel the open GCS session so it doesn't linger for up to 1 week.
|
||||
if session_uri:
|
||||
with contextlib.suppress(Exception):
|
||||
await http_request("DELETE", session_uri, timeout=10.0, label="cancel")
|
||||
await http_request(
|
||||
"DELETE", session_uri, timeout=10.0, label="cancel"
|
||||
)
|
||||
raise
|
||||
|
||||
verbose_proxy_logger.info(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue