From 9f5178ff0ce6d1b7b9c39e74ca906f29e88fd9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6ther?= Date: Tue, 24 Sep 2024 10:38:10 +0800 Subject: [PATCH] only pop if in there to avoid exception --- modyn/evaluator/internal/grpc/evaluator_grpc_servicer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modyn/evaluator/internal/grpc/evaluator_grpc_servicer.py b/modyn/evaluator/internal/grpc/evaluator_grpc_servicer.py index 4db4486bb..d92d064b3 100644 --- a/modyn/evaluator/internal/grpc/evaluator_grpc_servicer.py +++ b/modyn/evaluator/internal/grpc/evaluator_grpc_servicer.py @@ -353,9 +353,12 @@ def cleanup_evaluations( self._evaluation_process_dict.pop(evaluation_id) for e_id in evaluation_ids: - self._evaluation_dict.pop(e_id) - self._evaluation_data_dict.pop(e_id) - self._evaluation_data_dict_locks.pop(e_id) + if e_id in self._evaluation_dict: + self._evaluation_dict.pop(e_id) + if e_id in self._evaluation_data_dict: + self._evaluation_data_dict.pop(e_id) + if e_id in self._evaluation_data_dict_locks: + self._evaluation_data_dict_locks.pop(e_id) gc.collect() return EvaluationCleanupResponse(succeeded=list(sorted(already_cleaned + not_yet_cleaned)))