Skip to content

Commit b089733

Browse files
committed
make memoizer into an interface class and impls
1 parent c8f6b14 commit b089733

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

parsl/dataflow/dflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from parsl.dataflow.dependency_resolvers import SHALLOW_DEPENDENCY_RESOLVER
3232
from parsl.dataflow.errors import DependencyError, JoinError
3333
from parsl.dataflow.futures import AppFuture
34-
from parsl.dataflow.memoization import Memoizer
34+
from parsl.dataflow.memoization import BasicMemoizer, Memoizer
3535
from parsl.dataflow.rundirs import make_rundir
3636
from parsl.dataflow.states import FINAL_FAILURE_STATES, FINAL_STATES, States
3737
from parsl.dataflow.taskrecord import TaskRecord
@@ -173,7 +173,7 @@ def __init__(self, config: Config) -> None:
173173
else:
174174
checkpoint_files = []
175175

176-
self.memoizer = Memoizer(self, memoize=config.app_cache, checkpoint_files=checkpoint_files)
176+
self.memoizer: Memoizer = BasicMemoizer(self, memoize=config.app_cache, checkpoint_files=checkpoint_files)
177177
self.memoizer.run_dir = self.run_dir
178178

179179
self._checkpoint_timer = None

parsl/dataflow/memoization.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ def id_for_memo_function(f: types.FunctionType, output_ref: bool = False) -> byt
121121

122122

123123
class Memoizer:
124+
def update_memo(self, task: TaskRecord, r: Future[Any]) -> None:
125+
raise NotImplementedError
126+
127+
def checkpoint(self, tasks: Sequence[TaskRecord]) -> str:
128+
raise NotImplementedError
129+
130+
def check_memo(self, task: TaskRecord) -> Optional[Future[Any]]:
131+
raise NotImplementedError
132+
133+
134+
class BasicMemoizer(Memoizer):
124135
"""Memoizer is responsible for ensuring that identical work is not repeated.
125136
126137
When a task is repeated, i.e., the same function is called with the same exact arguments, the

0 commit comments

Comments
 (0)