Skip to content

Commit

Permalink
Fix get_s3_config
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Nov 22, 2024
1 parent 80b5d40 commit 2298041
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hypha/VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "0.20.39.post15"
"version": "0.20.39.post16"
}
19 changes: 12 additions & 7 deletions hypha/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ def _get_zenodo_client(self, artifact, parent_artifact=None, publish_to=None):

return zenodo_client

def _get_s3_config(self, artifact, parent_artifact=None):
def _get_s3_config(self, artifact, parent_artifact):
"""
Get S3 configuration using credentials from the artifact's or parent artifact's secrets.
"""
Expand Down Expand Up @@ -808,13 +808,18 @@ async def _save_version_to_s3(self, version_index: int, artifact, s3_config):
)

async def _load_version_from_s3(
self, artifact, version_index: int, s3_config, include_secrets=False
self,
artifact,
parent_artifact,
version_index: int,
s3_config,
include_secrets=False,
):
"""
Load the version from S3.
"""
assert version_index >= 0, "Version index must be non-negative."
s3_config = self._get_s3_config(artifact)
s3_config = self._get_s3_config(artifact, parent_artifact)
version_key = safe_join(
s3_config["prefix"],
artifact.workspace,
Expand Down Expand Up @@ -1260,9 +1265,9 @@ async def read(
artifact, parent_artifact
)
else:
s3_config = self._get_s3_config(artifact)
s3_config = self._get_s3_config(artifact, parent_artifact)
artifact_data = await self._load_version_from_s3(
artifact, version_index, s3_config
artifact, parent_artifact, version_index, s3_config
)

if artifact.type == "collection":
Expand Down Expand Up @@ -1313,9 +1318,9 @@ async def commit(
# the new version index
version_index = self._get_version_index(artifact, "stage")
# Load the staged version
s3_config = self._get_s3_config(artifact)
s3_config = self._get_s3_config(artifact, parent_artifact)
artifact_data = await self._load_version_from_s3(
artifact, version_index, s3_config
artifact, parent_artifact, version_index, s3_config
)
artifact = ArtifactModel(**artifact_data)

Expand Down

0 comments on commit 2298041

Please sign in to comment.