-
Notifications
You must be signed in to change notification settings - Fork 145
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
Refactor[BMQ,MQB,CI]: various improvements #604
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
|
||
logger = logging.getLogger(__name__) | ||
|
||
CORE_PATTERN_PATH = "/proc/sys/kernel/core_pattern" | ||
|
||
|
||
def _match_broker(broker, **kw): | ||
datacenter = kw.get("datacenter", None) | ||
|
@@ -205,29 +207,7 @@ def stop(self): | |
|
||
self.last_known_leader = None | ||
bad_exit = False | ||
cores_dir = None | ||
|
||
if self.copy_cores is not None: | ||
try: | ||
with open("/proc/sys/kernel/core_pattern") as core_pattern_file: | ||
pattern = core_pattern_file.readline().strip() | ||
if "%p" in pattern: | ||
cores_dir = Path(pattern).parent | ||
if not cores_dir.is_absolute(): | ||
self._logger.warning( | ||
"core pattern '%s' is not an absolute path, cores will not be saved", | ||
pattern, | ||
) | ||
cores_dir = None | ||
else: | ||
self._logger.warning( | ||
"core pattern '%s' does not contain process id, cores will not be saved", | ||
pattern, | ||
) | ||
except FileExistsError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was a wrong type of error |
||
self._logger.warning( | ||
"/proc/sys/kernel/core_pattern does not exist, cores will not be saved" | ||
) | ||
cores_dir = None if self.copy_cores is None else self._find_cores_dir() | ||
|
||
for process in processes: | ||
process.wait() | ||
|
@@ -685,6 +665,31 @@ def reconfigure_domain( | |
########################################################################### | ||
# Internals | ||
|
||
def _find_cores_dir(self) -> Optional[Path]: | ||
try: | ||
with open(CORE_PATTERN_PATH) as core_pattern_file: | ||
pattern = core_pattern_file.readline().strip() | ||
if "%p" in pattern: | ||
cores_dir = Path(pattern).parent | ||
if cores_dir.is_absolute(): | ||
return cores_dir | ||
|
||
self._logger.warning( | ||
"core pattern '%s' is not an absolute path, cores will not be saved", | ||
pattern, | ||
) | ||
else: | ||
self._logger.warning( | ||
"core pattern '%s' does not contain process id, cores will not be saved", | ||
pattern, | ||
) | ||
except FileNotFoundError: | ||
self._logger.warning( | ||
"%s does not exist, cores will not be saved", CORE_PATTERN_PATH | ||
) | ||
|
||
return None | ||
|
||
def _start_broker(self, broker: cfg.Broker, array, cluster_name): | ||
if broker.name in self._processes: | ||
raise RuntimeError(f'node "{broker.name}" is already running') | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This close was nonblocking, it was possible to execute the next command before producer was actually closed