Skip to content

Commit

Permalink
reduce logging in s3_client
Browse files Browse the repository at this point in the history
  • Loading branch information
FynnBe committed May 15, 2024
1 parent 91b38f5 commit b3c0fe3
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions bioimageio_collection_backoffice/s3_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,13 @@ def put(
def put_pydantic(self, path: str, obj: BaseModel):
"""convenience method to upload a json file from a pydantic model"""
self.put_json_string(path, obj.model_dump_json(exclude_defaults=False))
logger.debug("Uploaded {} containing {}", self.get_file_url(path), obj)

def put_json(
self, path: str, json_value: Any # TODO: type json_value as JsonValue
):
"""convenience method to upload a json file from a json serializable value"""
json_str = json.dumps(json_value)
self.put_json_string(path, json_str)
logger.debug(
"Uploaded {} containing {}",
self.get_file_url(path),
f"{json_str[:100]}{'...' if len(json_str)>100 else ''}",
)

def put_json_string(self, path: str, json_str: str):
data = json_str.encode()
Expand All @@ -125,7 +119,6 @@ def get_file_urls(
path: str = "",
) -> List[str]:
"""Checks an S3 'folder' for its list of files"""
logger.debug("Getting file list using {}, at {}", self, path)
prefix_folder = f"{self.prefix}/"
path = f"{prefix_folder}{path}"
objects = self._client.list_objects(self.bucket, prefix=path, recursive=True)
Expand Down

0 comments on commit b3c0fe3

Please sign in to comment.