Skip to content

Commit

Permalink
close method for api
Browse files Browse the repository at this point in the history
  • Loading branch information
benclifford committed Aug 22, 2024
1 parent e78e12d commit 9ff13d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,7 @@ def cleanup(self) -> None:

self.log_task_states()

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

logger.info("Closing memoizer")
self.memoizer.close()
logger.info("Closed memoizer")

# Send final stats
logger.info("Sending end message for usage tracking")
self.usage_tracker.send_end_message()
Expand Down
6 changes: 6 additions & 0 deletions parsl/dataflow/memoization.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ class Memoizer:
def start(self, *, dfk: DataFlowKernel, memoize: bool = True, checkpoint_files: Sequence[str], run_dir: str) -> None:
raise NotImplementedError

def close(self) -> None:
raise NotImplementedError

def update_memo(self, task: TaskRecord, r: Future[Any]) -> None:
raise NotImplementedError

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

def close(self) -> None:
pass # nothing to close but more should move here

def check_memo(self, task: TaskRecord) -> Optional[Future[Any]]:
"""Create a hash of the task and its inputs and check the lookup table for this hash.
Expand Down

0 comments on commit 9ff13d7

Please sign in to comment.