Skip to content

Commit

Permalink
Merge pull request #1276 from mvdbeek/output_collect_robustness
Browse files Browse the repository at this point in the history
Pre-create expected output file on disk
  • Loading branch information
mvdbeek committed Oct 19, 2022
2 parents 0eee650 + d0fa043 commit d791736
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions planemo/galaxy/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,19 @@ def _history_content_download(self, ctx, history_id, dataset_id, to_path, filena
data["filename"] = filename

r = user_gi.make_get_request(url, params=data, stream=True, timeout=user_gi.timeout)
try:
r.raise_for_status()
except HTTPError as e:
# When a job fails abruptly the object store may not contain a dataset,
# and that results in an internal server error on the Galaxy side.
# We don't want this to break the rest of the test report.
# Should probably find a way to propagate this back into the report.
ctx.vlog(f"Failed to download history content at URL {url}, exception: {e}")
return

# Do write an output file before anything could fail, so that the downstream
# data collection doesn't fail. Comment below still applies.
with open(to_path, "wb") as fp:
try:
r.raise_for_status()
except HTTPError as e:
# When a job fails abruptly the object store may not contain a dataset,
# and that results in an internal server error on the Galaxy side.
# We don't want this to break the rest of the test report.
# Should probably find a way to propagate this back into the report.
ctx.vlog(f"Failed to download history content at URL {url}, exception: {e}")
return

for chunk in r.iter_content(chunk_size=bioblend.CHUNK_SIZE):
if chunk:
fp.write(chunk)
Expand Down

0 comments on commit d791736

Please sign in to comment.