Skip to content

Commit

Permalink
fix: temporary workaround for #28: wait for SHA256 sums to be compute…
Browse files Browse the repository at this point in the history
…d before uploading the next resource
  • Loading branch information
paulmueller committed Sep 7, 2021
1 parent ce89b55 commit 4db9a95
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dcoraid/upload/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,20 @@ def task_upload_resources(self):
exist_ok=True,
monitor_callback=self.monitor_callback)
self.paths_uploaded.append(path)
# Workaround until `package_revise` is in `resource_add`
# (https://github.com/DCOR-dev/DCOR-Aid/issues/28):
# Wait for the SHA256 sum to be computed by DCOR.
for _ in range(60):
sha256dict = resource_sha256_sums(
dataset_id=self.dataset_id,
api=self.api)
if sha256dict[resource_name] is not None:
break
time.sleep(10)
else:
warnings.warn(
f"SHA256 sum for {self.dataset_id}: "
+ f"{resource_name} not yet computed by DCOR!")
self.end_time = time.perf_counter()
self.set_state("online")
else:
Expand Down

0 comments on commit 4db9a95

Please sign in to comment.