55
66import parsl
77from parsl import python_app
8- from parsl .tests .configs .local_threads_checkpoint import fresh_config
8+ from parsl .config import Config
9+ from parsl .dataflow .memoization import BasicMemoizer
10+ from parsl .executors .threads import ThreadPoolExecutor
911
1012
11- @contextlib .contextmanager
12- def parsl_configured (run_dir , ** kw ):
13- c = fresh_config ()
14- c .run_dir = run_dir
15- for config_attr , config_val in kw .items ():
16- setattr (c , config_attr , config_val )
17- dfk = parsl .load (c )
18- for ex in dfk .executors .values ():
19- ex .working_dir = run_dir
20- yield dfk
21-
22- parsl .dfk ().cleanup ()
13+ def parsl_configured (run_dir , memoizer ):
14+ return parsl .load (Config (
15+ run_dir = str (run_dir ),
16+ executors = [
17+ ThreadPoolExecutor (
18+ label = 'local_threads_checkpoint' ,
19+ )
20+ ],
21+ memoizer = memoizer
22+ ))
2323
2424
2525@python_app (cache = True )
@@ -32,11 +32,11 @@ def uuid_app():
3232def test_loading_checkpoint (tmpd_cwd ):
3333 """Load memoization table from previous checkpoint
3434 """
35- with parsl_configured (tmpd_cwd , checkpoint_mode = "task_exit" ):
35+ with parsl_configured (tmpd_cwd , BasicMemoizer ( checkpoint_mode = "task_exit" ) ):
3636 checkpoint_files = [os .path .join (parsl .dfk ().run_dir , "checkpoint" )]
3737 result = uuid_app ().result ()
3838
39- with parsl_configured (tmpd_cwd , checkpoint_files = checkpoint_files ):
39+ with parsl_configured (tmpd_cwd , BasicMemoizer ( checkpoint_files = checkpoint_files ) ):
4040 relaunched = uuid_app ().result ()
4141
4242 assert result == relaunched , "Expected following call to uuid_app to return cached uuid"
0 commit comments