Skip to content

Commit

Permalink
increase timeout, add more suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codekansas committed Sep 4, 2024
1 parent a0b0fad commit d2877cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions kscale/store/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def __init__(self, base_url: str = get_api_root()) -> None:
self.client = httpx.AsyncClient(
base_url=self.base_url,
headers={"Authorization": f"Bearer {get_api_key()}"},
timeout=httpx.Timeout(30.0),
)

async def _request(
Expand Down
13 changes: 12 additions & 1 deletion kscale/store/urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

ALLOWED_SUFFIXES = {
".urdf",
".mjcf",
".stl",
".obj",
".dae",
".png",
".jpg",
".jpeg",
}


def get_cache_dir() -> Path:
return Path(Settings.load().store.cache_dir).expanduser().resolve()
Expand Down Expand Up @@ -75,7 +86,7 @@ def create_tarball(folder_path: Path, output_filename: str, cache_dir: Path) ->
tarball_path = cache_dir / output_filename
with tarfile.open(tarball_path, "w:gz") as tar:
for file_path in folder_path.rglob("*"):
if file_path.is_file() and file_path.suffix.lower() in (".urdf", ".mjcf", ".stl", ".obj", ".dae"):
if file_path.is_file() and file_path.suffix.lower() in ALLOWED_SUFFIXES:
tar.add(file_path, arcname=file_path.relative_to(folder_path))
logger.info("Added %s to tarball", file_path)
else:
Expand Down

0 comments on commit d2877cb

Please sign in to comment.