Skip to content

Commit

Permalink
feat(client): add environment variables for model copy timeout and re…
Browse files Browse the repository at this point in the history
…tries (#2395)
  • Loading branch information
xuchuan authored Jun 25, 2023
1 parent 148b4b5 commit 53a0e77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/starwhale/core/model/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ def _prepare_common_contextvars() -> None:
_blob_sem.set(
trio.Semaphore(int(os.environ.get("SW_BUNDLE_COPY_BUFFER_BLOBS", "32")))
)
timeout = httpx.Timeout(10.0, connect=30.0)
timeout = httpx.Timeout(
float(os.environ.get("SW_BUNDLE_COPY_DATA_NET_TIMEOUT", "90"))
)
limits = httpx.Limits(
max_keepalive_connections=_net_sem.get().value,
max_connections=_net_sem.get().value,
)
transport = httpx.AsyncHTTPTransport(retries=3, limits=limits)
transport = httpx.AsyncHTTPTransport(
retries=int(os.environ.get("SW_BUNDLE_COPY_DATA_NET_RETRY", "10")),
limits=limits,
)
_httpx_client.set(
httpx.AsyncClient(timeout=timeout, limits=limits, transport=transport)
)
Expand Down

0 comments on commit 53a0e77

Please sign in to comment.