Skip to content

Commit

Permalink
Rename asset_uuid to blob_uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Mar 22, 2021
1 parent 941c16e commit 2439b62
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions dandi/dandiapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def iter_upload(self, dandiset_id, version_id, asset_metadata, filepath):
else:
lgr.debug("%s: Blob is already uploaded to server", asset_path)
blob_exists = True
asset_uuid = resp["uuid"]
blob_uuid = resp["uuid"]
if not blob_exists:
total_size = os.path.getsize(filepath)
lgr.debug("%s: Beginning upload", asset_path)
Expand All @@ -441,7 +441,7 @@ def iter_upload(self, dandiset_id, version_id, asset_metadata, filepath):
},
},
)
asset_uuid = resp["uuid"]
blob_uuid = resp["uuid"]
# object_key = resp["multipart_upload"]["object_key"]
# upload_id = resp["multipart_upload"]["upload_id"]
parts = resp["multipart_upload"].get("parts", [])
Expand Down Expand Up @@ -505,7 +505,7 @@ def iter_upload(self, dandiset_id, version_id, asset_metadata, filepath):
)
lgr.debug("%s: Completing upload", asset_path)
resp = self.post(
f"/uploads/{asset_uuid}/complete/",
f"/uploads/{blob_uuid}/complete/",
json={"parts": parts_out},
)
lgr.debug(
Expand All @@ -527,24 +527,24 @@ def iter_upload(self, dandiset_id, version_id, asset_metadata, filepath):
"Server and client disagree on final ETag of uploaded file;"
f" server says {final_etag}, client says {filetag}"
)
resp = self.post(f"/uploads/{asset_uuid}/validate/")
resp = self.post(f"/uploads/{blob_uuid}/validate/")
# Another upload may have completed before this one, so the
# UUID in `resp` may not necessarily be the same as the upload
# UUID, so we should use `resp["uuid"]` instead from now on.
asset_uuid = resp["uuid"]
blob_uuid = resp["uuid"]
lgr.debug("%s: Assigning asset blob to dandiset & version", asset_path)
yield {"status": "producing asset"}
extant = self.get_asset_bypath(dandiset_id, version_id, asset_path)
if extant is None:
self.post(
f"/dandisets/{dandiset_id}/versions/{version_id}/assets/",
json={"metadata": asset_metadata, "uuid": asset_uuid},
json={"metadata": asset_metadata, "uuid": blob_uuid},
)
else:
lgr.debug("%s: Asset already exists at path; updating", asset_path)
self.put(
f"/dandisets/{dandiset_id}/versions/{version_id}/assets/{extant['uuid']}/",
json={"metadata": asset_metadata, "uuid": asset_uuid},
json={"metadata": asset_metadata, "uuid": blob_uuid},
)
lgr.info("%s: Asset successfully uploaded", asset_path)
yield {"status": "done"}
Expand Down

0 comments on commit 2439b62

Please sign in to comment.