Skip to content

Commit 73fa5ca

Browse files
committed
adding retry logic to the json.load of zenodo file (randomly one test gives me an error on travis, not able to reproduce...)
1 parent 2549f61 commit 73fa5ca

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

pydra/engine/boutiques.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,17 @@ def __init__(
7070
elif zenodo:
7171
bosh_file = self._download_spec(zenodo)
7272

73-
try:
74-
with bosh_file.open() as f:
75-
self.bosh_spec = json.load(f)
76-
except json.decoder.JSONDecodeError:
77-
with bosh_file.open() as f:
78-
print(f.read())
79-
raise
73+
# retry logic - an error on travis is raised randomly, not able to reproduce
74+
tries = 0
75+
while tries < 3:
76+
try:
77+
with bosh_file.open() as f:
78+
self.bosh_spec = json.load(f)
79+
break
80+
except json.decoder.JSONDecodeError:
81+
tries += 1
82+
if tries == 3:
83+
raise
8084

8185
if input_spec is None:
8286
input_spec = self._prepare_input_spec()

0 commit comments

Comments
 (0)