Skip to content

Commit

Permalink
Fix bug for adding simulations in series
Browse files Browse the repository at this point in the history
  • Loading branch information
apontzen committed Oct 11, 2023
1 parent 1238b8e commit 55fff96
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tangos/tools/add_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ def __init__(self, simulation_output, session=None, renumber=True, parallel=Fals
""":type simulation_output tangos.simulation_outputs.HandlerBase"""
self.simulation_output = simulation_output
if session is None:
# if running in parallel, creating a session for the first time may trigger a race condition e.g. if the
# database doesn't exist yet
with pt.ExclusiveLock("creating_database"):
if parallel:
# if running in parallel, creating a session for the first time may trigger a race condition e.g. if the
# database doesn't exist yet
with pt.ExclusiveLock("creating_database"):
session = core.get_default_session()
else:
session = core.get_default_session()
self.session = session
self.min_halo_particles = config.min_halo_particles
Expand Down

0 comments on commit 55fff96

Please sign in to comment.