From 1935fafe19cca4a3e520edb0fb625dce17cdd9a2 Mon Sep 17 00:00:00 2001 From: Arunima Chaudhuri Date: Tue, 14 May 2024 06:45:54 +0000 Subject: [PATCH] Fixed simulation completion check Signed-off-by: Arunima Chaudhuri --- study.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/study.py b/study.py index 6776e90..7ad33b5 100644 --- a/study.py +++ b/study.py @@ -147,7 +147,23 @@ def study(): execID = restart_path.split("/")[1] state_file = f"results/{execID}/backup" all_completed, incomplete_files, completed_files, completed_shapes = check_simulation_completion(state_file) - if all_completed: + + current_shapes = [] + config = importlib.import_module("smallConf") + + completed_shapes_without_seed = completed_shapes + for shape in config.nextShape(): + shape_dict = copy.deepcopy(shape.__dict__) + del shape_dict['randomSeed'] + current_shapes.append(shape_dict) + for shape in completed_shapes_without_seed: + if 'randomSeed' in shape: + del shape['randomSeed'] + + completed_set = {frozenset(shape.items()) for shape in completed_shapes_without_seed} + current_set = {frozenset(shape.items()) for shape in current_shapes} + + if all_completed and completed_set == current_set: print("Simulation is already completed.") sys.exit(0) else: