Skip to content

Commit 9b7d199

Browse files
authored
Use DFK in a with block in README (#3405)
This functionality was introduced in #3260 and we should be encouraging people to use it in order to clean up nicely, after PR #3165 took away atexit handler cleanup.
1 parent 0d1c30a commit 9b7d199

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Parsl lets you chain functions together and will launch each function as inputs
1515
import parsl
1616
from parsl import python_app
1717
18-
# Start Parsl on a single computer
19-
parsl.load()
2018
2119
# Make functions parallel by decorating them
2220
@python_app
@@ -27,12 +25,14 @@ Parsl lets you chain functions together and will launch each function as inputs
2725
def g(x):
2826
return x * 2
2927
30-
# These functions now return Futures, and can be chained
31-
future = f(1)
32-
assert future.result() == 2
28+
# Start Parsl on a single computer
29+
with parsl.load():
30+
# These functions now return Futures, and can be chained
31+
future = f(1)
32+
assert future.result() == 2
3333
34-
future = g(f(1))
35-
assert future.result() == 4
34+
future = g(f(1))
35+
assert future.result() == 4
3636
3737
3838
Start with the `configuration quickstart <https://parsl.readthedocs.io/en/stable/quickstart.html#getting-started>`_ to learn how to tell Parsl how to use your computing resource,

0 commit comments

Comments
 (0)