use shape for naming pickle files for restarting simulations

Signed-off-by: Arunima Chaudhuri <arunimachaudhuri2020@gmail.com>
This commit is contained in:
Arunima Chaudhuri 2024-05-13 16:14:14 +00:00
parent 04004ed1fb
commit 4ad181c91d

View File

@ -32,11 +32,10 @@ def runOnce(config, shape, execID):
shape.setSeed(config.randomSeed+"-"+str(shape))
random.seed(shape.randomSeed)
unique_run_id = str(uuid.uuid4())
backup_folder = f"results/{execID}/backup"
if not os.path.exists(backup_folder):
os.makedirs(backup_folder)
backup_file = os.path.join(backup_folder, f"simulation_data_{unique_run_id}.pkl")
backup_file = os.path.join(backup_folder, f"simulation_data_{shape}.pkl")
with open(backup_file, 'ab') as f:
pickle.dump(shape.__dict__, f)