From e35627327f1f7298125524d5ca8daf4b48d29941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6ther?= Date: Mon, 23 Sep 2024 22:50:03 +0800 Subject: [PATCH 1/2] fix some evaluator tets to new valid meaning --- .../evaluator/internal/grpc/test_evaluator_grpc_servicer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modyn/tests/evaluator/internal/grpc/test_evaluator_grpc_servicer.py b/modyn/tests/evaluator/internal/grpc/test_evaluator_grpc_servicer.py index 1be7ea675..91a7fb77c 100644 --- a/modyn/tests/evaluator/internal/grpc/test_evaluator_grpc_servicer.py +++ b/modyn/tests/evaluator/internal/grpc/test_evaluator_grpc_servicer.py @@ -485,7 +485,7 @@ def test__run_evaluation_retain_metrics_before_real_exception(test_connect_to_st get_result_req = EvaluationResultRequest(evaluation_id=evaluation_id) get_result_resp = evaluator.get_evaluation_result(get_result_req, None) - assert get_result_resp.valid + assert not get_result_resp.valid # evaluation on the last interval was not finished assert len(get_result_resp.evaluation_results) == len(intervals) - 1 assert get_result_resp.evaluation_results[0].interval_index == 0 @@ -535,7 +535,7 @@ def test_get_evaluation_result_incomplete_metric(test_is_alive, test_connect_to_ metric_result_queue = evaluation_process_info.metric_result_queue metric_result_queue.put((1, [("Accuracy", 0.5)])) response = evaluator.get_evaluation_result(EvaluationResultRequest(evaluation_id=3), None) - assert response.valid + assert not response.valid assert len(response.evaluation_results) == 1 assert response.evaluation_results[0].interval_index == 1 assert len(response.evaluation_results[0].evaluation_data) == 1 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 2/2] 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)))