Skip to content

Commit d2487a8

Browse files
committed
Re-raise infrastructure errors during output collection
Surface ImportError, MemoryError, SystemError and infrastructure OSErrors (e.g. disk full, I/O errors) during output collection instead of silently downgrading them to warnings, so they fail the job rather than producing a job that 'succeeds' with empty outputs. Two exceptions are deliberately NOT treated as infrastructure failures and keep flowing through the normal _allow_collect_failure handling: * FileNotFoundError — a missing output file is expected and recoverable (e.g. a from_work_dir output the tool legitimately did not produce, which Galaxy represents as an empty dataset). * HTTP 403 — Galaxy authoritatively refused the upload (dataset purged mid job); checked before the OSError test because requests.HTTPError is itself an OSError subclass.
1 parent b2454a8 commit d2487a8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

pulsar/client/staging/down.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ def _collect_output(self, output_type, action, name):
232232
log.info("collecting output {} with action {}".format(name, action))
233233
try:
234234
return self.output_collector.collect_output(self, output_type, action, name)
235+
except (ImportError, MemoryError, SystemError):
236+
# Genuine infrastructure failures must never be downgraded.
237+
raise
235238
except Exception as e:
236239
if http_status_code(e) == 403:
237240
# The Galaxy server authoritatively refused this upload (HTTP
@@ -240,6 +243,9 @@ def _collect_output(self, output_type, action, name):
240243
# the dataset's state, retrying cannot help, and the tool itself
241244
# ran, so this must not fail the job. Surface the path/output so
242245
# the reason is visible rather than a generic failure.
246+
#
247+
# Checked before the OSError branch below because
248+
# requests.HTTPError is itself an OSError subclass.
243249
log.warning(
244250
"Galaxy refused output '%s' (HTTP 403) at %s; not failing the job. "
245251
"This is expected when the output dataset was purged or deleted "
@@ -248,6 +254,14 @@ def _collect_output(self, output_type, action, name):
248254
getattr(action, "url", None) or getattr(action, "path", action),
249255
)
250256
return False
257+
if isinstance(e, OSError) and not isinstance(e, FileNotFoundError):
258+
# Infrastructure OSErrors (disk full, I/O errors) must fail the
259+
# job rather than be silently downgraded to a warning. A missing
260+
# output file (FileNotFoundError) is excluded: it is an expected,
261+
# recoverable condition — e.g. a ``from_work_dir`` output a tool
262+
# legitimately did not produce, which Galaxy represents as an
263+
# empty dataset — so it flows through the normal handling below.
264+
raise
251265
if _allow_collect_failure(output_type):
252266
log.warning(
253267
"Allowed failure in postprocessing, will not force job failure but generally indicates a tool"

0 commit comments

Comments
 (0)