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 view: Set max number of opened file at start-up #3545

Merged
merged 1 commit into from Nov 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/silx/app/view/main.py
Expand Up @@ -86,6 +86,21 @@ def mainQt(options):
# Import most of the things here to be sure to use the right logging level
#

# Use max opened files hard limit as soft limit
try:
import resource
except ImportError:
_logger.debug("No resource module available")
else:
if hasattr(resource, 'RLIMIT_NOFILE'):
try:
hard_nofile = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
resource.setrlimit(resource.RLIMIT_NOFILE, (hard_nofile, hard_nofile))
except (ValueError, OSError):
_logger.warning("Failed to retrieve and set the max opened files limit")
else:
_logger.debug("Set max opened files to %d", hard_nofile)

# This needs to be done prior to load HDF5
hdf5_file_locking = 'TRUE' if options.hdf5_file_locking else 'FALSE'
_logger.info('Set HDF5_USE_FILE_LOCKING=%s', hdf5_file_locking)
Expand Down