in submitit/core/core.py [0:0]
def exception(self) -> tp.Optional[tp.Union[utils.UncompletedJobError, utils.FailedJobError]]:
"""Waits for completion and returns (not raise) the
exception containing the error log of the job
Returns
-------
Exception/None
the exception if any was raised during the job.
If the job has several tasks, it returns the exception of the task with
smallest id that failed.
Raises
------
UncompletedJobError
In case the job never completed
"""
self.wait()
if self._sub_jobs:
all_exceptions = [sub_job.exception() for sub_job in self._sub_jobs]
# unexpected pylint issue on correct code:
exceptions = [
e for e in all_exceptions if e is not None # pylint: disable=used-before-assignment
]
if not exceptions:
return None
return exceptions[0]
try:
outcome, trace = self._get_outcome_and_result()
except utils.UncompletedJobError as e:
return e
if outcome == "error":
return utils.FailedJobError(
f"Job (task={self.task_id}) failed during processing with trace:\n"
f"----------------------\n{trace}\n"
"----------------------\n"
f"You can check full logs with 'job.stderr({self.task_id})' and 'job.stdout({self.task_id})'"
f"or at paths:\n - {self.paths.stderr}\n - {self.paths.stdout}"
)
return None