Skip to content

Commit 9ff13d7

Browse files
committed
close method for api
1 parent e78e12d commit 9ff13d7

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

parsl/dataflow/dflow.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,7 @@ def cleanup(self) -> None:
12601260

12611261
self.log_task_states()
12621262

1263+
# TODO: do this in the basic memoizer
12631264
# Checkpointing takes priority over the rest of the tasks
12641265
# checkpoint if any valid checkpoint method is specified
12651266
if self.checkpoint_mode is not None:
@@ -1272,6 +1273,10 @@ def cleanup(self) -> None:
12721273
logger.info("Stopping checkpoint timer")
12731274
self._checkpoint_timer.close()
12741275

1276+
logger.info("Closing memoizer")
1277+
self.memoizer.close()
1278+
logger.info("Closed memoizer")
1279+
12751280
# Send final stats
12761281
logger.info("Sending end message for usage tracking")
12771282
self.usage_tracker.send_end_message()

parsl/dataflow/memoization.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ class Memoizer:
161161
def start(self, *, dfk: DataFlowKernel, memoize: bool = True, checkpoint_files: Sequence[str], run_dir: str) -> None:
162162
raise NotImplementedError
163163

164+
def close(self) -> None:
165+
raise NotImplementedError
166+
164167
def update_memo(self, task: TaskRecord, r: Future[Any]) -> None:
165168
raise NotImplementedError
166169

@@ -236,6 +239,9 @@ def start(self, *, dfk: DataFlowKernel, memoize: bool = True, checkpoint_files:
236239
logger.info("App caching disabled for all apps")
237240
self.memo_lookup_table = {}
238241

242+
def close(self) -> None:
243+
pass # nothing to close but more should move here
244+
239245
def check_memo(self, task: TaskRecord) -> Optional[Future[Any]]:
240246
"""Create a hash of the task and its inputs and check the lookup table for this hash.
241247

0 commit comments

Comments
 (0)