Skip to content

Commit

Permalink
Suppress warnings for HDF5 locks
Browse files Browse the repository at this point in the history
  • Loading branch information
kboone committed May 17, 2019
1 parent 8e3433a commit d886820
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion avocado/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def write_dataframe(path, dataframe, key, overwrite=False, append=False,
)

# Get a lock on the HDF5 file.
num_fails = 0
while True:
try:
store = pd.HDFStore(path, 'a')
Expand All @@ -285,12 +286,22 @@ def write_dataframe(path, dataframe, key, overwrite=False, append=False,
if not append:
raise

logger.warning(
logger.info(
"Couldn't get lock for HDF5 file %s... another process is "
"probably using it. Retrying in %d seconds."
% (path, timeout)
)

num_fails += 1

if num_fails % 40 == 0:
logger.warning(
"Failed %d times to get lock for HDF5 file %s... will "
"keep trying (there are probably a lot of processes "
"trying to write to it)."
% (num_fails, path)
)

time.sleep(timeout)
else:
# Got the lock successfully.
Expand Down

0 comments on commit d886820

Please sign in to comment.