From 2120a5d446d2fbefa7b99dca9a595d8d7537ce00 Mon Sep 17 00:00:00 2001 From: Sibo Wang Date: Tue, 18 Jun 2024 10:03:47 +0200 Subject: [PATCH] Fix bug in parallelized closed-loop plume tracking At some point we made the run_simulation function return the Simulation object to facilitate testing. However this broke the parallel execution of the code because parallelization (at least via joblib) pickles the returned object in the reduce step. However, the Simulation object is not pickle-able. --- flygym/examples/olfaction/track_plume_closed_loop.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flygym/examples/olfaction/track_plume_closed_loop.py b/flygym/examples/olfaction/track_plume_closed_loop.py index 78ea3246..30590758 100644 --- a/flygym/examples/olfaction/track_plume_closed_loop.py +++ b/flygym/examples/olfaction/track_plume_closed_loop.py @@ -139,7 +139,9 @@ def run_simulation( def process_trial(plume_dataset_path, output_dir, seed, initial_position, is_control): try: - return run_simulation( + # Run_simulation returns a Simulation object, which is not + # pickle-able. Do not return it here in this wrapper. + run_simulation( plume_dataset_path, output_dir, seed,