Skip to content

Commit

Permalink
Rework _get_error in simple_error_handler to give more information
Browse files Browse the repository at this point in the history
Before (in pytest output, with htex launch_cmd="/bin/false"):

```
Exception: 	STDOUT: Found cores : 8
Launching worker: 1
```

After:

```
parsl.jobs.errors.TooManyJobFailuresError: Error 1:
	EXIT CODE: 1
	STDOUT: Found cores : 8
Launching worker: 1
```

* Fix counting so it counts even when js.message is None

* Add exit code

* Use a new error subclass rather than Exception

* Pluralise messages in for no-messages string and remove brackets

  '[No error message received]'
    vs
  'No error messages received'
  • Loading branch information
benclifford committed Aug 11, 2023
1 parent eb7ffe9 commit 8e01cb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
7 changes: 7 additions & 0 deletions parsl/jobs/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from parsl.errors import ParslError


class TooManyJobFailuresError(ParslError):
"""Indicates that executor is shut down because of too many block failures.
"""
pass
16 changes: 12 additions & 4 deletions parsl/jobs/simple_error_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import parsl.executors.status_handling as status_handling
from parsl.jobs.states import JobStatus, JobState
from parsl.jobs.errors import TooManyJobFailuresError


def simple_error_handler(executor: status_handling.BlockProviderExecutor, status: Dict[str, JobStatus], threshold: int):
Expand All @@ -27,18 +28,25 @@ def _get_error(status: Dict[str, JobStatus]) -> Exception:
err = ""
count = 1
for js in status.values():
err = err + f"Error {count}:\n"
count += 1

if js.message is not None:
err = err + "{}. {}\n".format(count, js.message)
count += 1
err = err + f"\t{js.message}\n"

if js.exit_code is not None:
err = err + f"\tEXIT CODE: {js.exit_code}\n"

stdout = js.stdout_summary
if stdout:
err = err + "\tSTDOUT: {}\n".format(stdout)

stderr = js.stderr_summary
if stderr:
err = err + "\tSTDERR: {}\n".format(stderr)

if len(err) == 0:
err = "[No error message received]"
err = "No error messages received"
# wrapping things in an exception here doesn't really help in providing more information
# than the string itself
return Exception(err)
return TooManyJobFailuresError(err)

0 comments on commit 8e01cb9

Please sign in to comment.