Skip to content

Commit c3d47f6

Browse files
committed
Clarify that exceptions are memoized but not checkpointed
1 parent 0b9cd5b commit c3d47f6

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

docs/userguide/workflows/checkpoints.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ This can save time and computational resources.
1010

1111
This is done in two ways:
1212

13-
* Firstly, *app caching* will allow reuse of results within the same run.
13+
* Firstly, *app caching* will allow reuse of results and exceptions within
14+
the same run.
1415

15-
* Building on top of that, *checkpointing* will store results on the filesystem
16-
and reuse those results in later runs.
16+
* Building on top of that, *checkpointing* will store results (but not
17+
exceptions) on the filesystem and reuse those results in later runs.
1718

1819
.. _label-appcaching:
1920

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import argparse
2+
3+
import parsl
4+
from parsl.app.app import python_app
5+
6+
7+
@python_app(cache=True)
8+
def raise_exception(x, cache=True):
9+
raise RuntimeError("exception from raise_exception")
10+
11+
12+
def test_python_memoization(n=2):
13+
"""Testing python memoization with exceptions."""
14+
x = raise_exception(0)
15+
16+
# wait for x to be done
17+
x.exception()
18+
19+
for i in range(0, n):
20+
foo = raise_exception(0)
21+
print(foo.exception())
22+
assert foo.exception() == x.exception(), "Memoized exceptions were not used"

0 commit comments

Comments
 (0)