File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
parsl/tests/test_python_apps Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,11 @@ This can save time and computational resources.
1010
1111This 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
Original file line number Diff line number Diff line change 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"
You can’t perform that action at this time.
0 commit comments