Skip to content

Commit

Permalink
bump timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Jan 16, 2025
1 parent 0cb0fe8 commit 4a6e040
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kscale/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Configuration
omegaconf
email_validator
colorlogging

# HTTP requests
aiohttp
Expand All @@ -17,6 +16,7 @@ yarl
# CLI
aiofiles
click
colorlogging
tabulate

# Async
Expand Down
11 changes: 9 additions & 2 deletions kscale/web/clients/robot_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

logger = logging.getLogger(__name__)

UPLOAD_TIMEOUT = 300.0
DOWNLOAD_TIMEOUT = 60.0


class RobotClassClient(BaseClient):
async def get_robot_classes(self) -> list[RobotClass]:
Expand Down Expand Up @@ -77,7 +80,9 @@ async def upload_robot_class_urdf(self, class_name: str, urdf_file: str | Path)
auth=True,
)
response = RobotUploadURDFResponse.model_validate(data)
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(
timeout=httpx.Timeout(UPLOAD_TIMEOUT),
) as client:
async with client.stream(
"PUT",
response.url,
Expand All @@ -97,7 +102,9 @@ async def download_robot_class_urdf(self, class_name: str, *, cache: bool = True
cache_path.parent.mkdir(parents=True, exist_ok=True)

logger.info("Downloading URDF file from %s", response.url)
async with httpx.AsyncClient() as client:
async with httpx.AsyncClient(
timeout=httpx.Timeout(DOWNLOAD_TIMEOUT),
) as client:
with open(cache_path, "wb") as file:
hash_value = hashlib.md5()
async with client.stream("GET", response.url) as r:
Expand Down

0 comments on commit 4a6e040

Please sign in to comment.