Skip to content

Commit 0dd4089

Browse files
committed
ref: improved artifact existence check
1 parent 33d9426 commit 0dd4089

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

dcor_shared/data.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,21 @@ def wait_for_resource(resource_id: str,
5959
time.sleep(5)
6060
continue
6161

62+
# object exists in database?
6263
s3_ok = res_dict.get("s3_available", None)
6364
if s3_ok:
6465
# If the resource is on S3, it is considered to be available.
6566
break
66-
elif s3cc.artifact_exists(res_dict["id"]):
67-
# It is on S3, but not yet registered. That's fine.
67+
68+
# object exists on S3?
69+
try:
70+
s3_exist = s3cc.artifact_exists(res_dict["id"])
71+
except BaseException:
72+
s3_exist = False
73+
if s3_exist:
6874
break
69-
elif time.time() - t0 > timeout:
75+
76+
if time.time() - t0 > timeout:
7077
raise OSError("Data import seems to take too long "
7178
"for '{}'!".format(path))
7279
elif not path.exists():

0 commit comments

Comments
 (0)