Skip to content

Commit

Permalink
Attempt setting env var HDF5_USE_FILE_LOCKING to false when opening n…
Browse files Browse the repository at this point in the history
…etcdf file on failure
  • Loading branch information
andrrizzi committed May 30, 2019
1 parent 53170a1 commit 27c43ce
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions openmmtools/multistate/multistatereporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ def _open_dataset_robustly(self, *args, n_attempts=5, sleep_time=2,
'in {} seconds'.format(attempt+1, n_attempts, sleep_time))
time.sleep(sleep_time)

# At the very last attempt, we try setting the environment variable
# controlling the locking mechanism of HDF5 (see choderalab/yank#1165).
if n_attempts > 1:
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'

# Last attempt finally raises any error.
return netcdf.Dataset(*args, **kwargs)
Expand Down

0 comments on commit 27c43ce

Please sign in to comment.