-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give some helpful info on a suspected serialization error
Motivated by some requests in #help and by the fact that diagnosing and fixing serialization-related errors is currently a rather arcane task.
- Loading branch information
1 parent
aba6d45
commit ef3659a
Showing
2 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import traceback | ||
from functools import lru_cache | ||
|
||
import pytest | ||
from globus_compute_sdk.errors import TaskExecutionFailed | ||
from globus_compute_sdk.serialize import DillCodeSource | ||
|
||
|
||
@lru_cache(maxsize=None) | ||
def annotated_function(): | ||
return "data" | ||
|
||
|
||
def test_task_execution_failed_serialization_help_msg(): | ||
try: | ||
DillCodeSource().serialize(annotated_function) | ||
except OSError: | ||
tb = traceback.format_exc() | ||
else: | ||
pytest.fail("Expected DillCodeSource to fail to serialize annotated functions") | ||
|
||
tef = TaskExecutionFailed(tb) | ||
assert "This appears to be an error with serialization." in str(tef) | ||
assert ( | ||
"https://globus-compute.readthedocs.io/en/latest/sdk.html" | ||
"#specifying-a-serialization-strategy" in str(tef) | ||
) |