Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silx.io.h5py_utils.File: avoid emitting several time warning if incoherent hdf5 / h5py locking argument #4092

Closed
wants to merge 1 commit into from

Conversation

payno
Copy link
Member

@payno payno commented Mar 21, 2024

avoid emitting several time warning if incoherent hdf5 / h5py locking argument.
Done with a decorator to try to improve readability

@payno payno added this to the 2.1.0 milestone Mar 21, 2024
@payno
Copy link
Member Author

payno commented Mar 21, 2024

I have to admit I am a bit uncertain about this PR.
To be considered:
* If users have particular version on h5py / hdf5 en get incoherent locking parameter we will get a tone of warning at the moment. But the class will hardly failed. (as expressed in the warning). So it might be not that bad that logs are filled with the error.
* but some users knowing very well what they are doing might that this cumbersome. But do we have such users ?
* This will increase complexity of the class (I did a decorator to try to reduce it). Not sure if I succeed.

Copy link
Member

@t20100 t20100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provided it's a critical log message and the issues we have with HDF5 file locking, I'm not sure making this log quiet is a good idea.

What could be improved is that the message is logged without checking if locking is actually disabled, so moving the log below and checking the value of locking would save a few unwanted messages.

return wrapper


@only_once
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could (ab)use functools.lru_cache here and save the global variable

h5py.version.hdf5_version, h5py.version.version
)
)
warm_incoherent_locking_argument()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this makes it more complicated to have a function to log a specific message

@payno
Copy link
Member Author

payno commented Mar 21, 2024

Agree, let close this one for the moment and we might rethink it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants