Utils: add an helper to increase opened file soft limit#4613
Open
maxenceprog wants to merge 1 commit into
Open
Utils: add an helper to increase opened file soft limit#4613maxenceprog wants to merge 1 commit into
maxenceprog wants to merge 1 commit into
Conversation
- create a new module in silx.utils - call the new function in silx.app.view.main
maxenceprog
commented
Jun 15, 2026
| # THE SOFTWARE. | ||
| # | ||
| # ###########################################################################*/ | ||
| """Utils function relative to system limit""" |
Author
There was a problem hiding this comment.
well, i miss of imagination here
maxenceprog
commented
Jun 15, 2026
| _logger = logging.getLogger() | ||
|
|
||
|
|
||
| def increase_max_opened_files(): |
Author
There was a problem hiding this comment.
what do you think about that name ?
t20100
reviewed
Jun 15, 2026
t20100
left a comment
Member
There was a problem hiding this comment.
IMO best to avoid lazy import while at it
Comment on lines
-134
to
+125
| from silx.gui import qt | ||
|
|
||
| # Make sure matplotlib is configured | ||
| import silx.gui.utils.matplotlib # noqa | ||
| from silx.gui import qt |
Member
There was a problem hiding this comment.
There is no reason to change import order in this PR
| @@ -0,0 +1,49 @@ | |||
| # /*########################################################################## | |||
| # | |||
| # Copyright (c) 2019 European Synchrotron Radiation Facility | |||
Member
There was a problem hiding this comment.
If set best to use the right date:
Suggested change
| # Copyright (c) 2019 European Synchrotron Radiation Facility | |
| # Copyright (c) 2026 European Synchrotron Radiation Facility |
| _logger = logging.getLogger() | ||
|
|
||
|
|
||
| def increase_max_opened_files(): |
Comment on lines
+37
to
+42
| try: | ||
| import resource | ||
| except ImportError: | ||
| _logger.debug("No resource module available") | ||
| else: | ||
| if hasattr(resource, "RLIMIT_NOFILE"): |
Member
There was a problem hiding this comment.
What about putting import at the top of the file to avoid lazy loading:
try:
import resource
except ImportError:
resource = None
and use this here:
Suggested change
| try: | |
| import resource | |
| except ImportError: | |
| _logger.debug("No resource module available") | |
| else: | |
| if hasattr(resource, "RLIMIT_NOFILE"): | |
| if resource is None: | |
| _logger.debug("No resource module available") | |
| return | |
| if hasattr(resource, "RLIMIT_NOFILE"): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #4608
<Module or Topic>: <Action> <Summary>(see contributing guidelines)PR summary
AI Disclosure