Adding rabbitmq to Pavilion for sending data #1075
Draft
cielling wants to merge 1 commit into
Draft
Conversation
hwikle-lanl
requested changes
May 27, 2026
| import sys | ||
| import json | ||
| import ssl | ||
| from pika import BlockingConnection, ConnectionParameters, SSLOptions, BasicProperties |
Collaborator
There was a problem hiding this comment.
Add pika (probably version 1.3) as a vendored dependency under lib/sub_repos, with a symlink under lib.
| "port": 5671, | ||
| "vhost": "pavilion", | ||
| "exchange": "pavilion", | ||
| "routing_key": "test.result" |
Collaborator
There was a problem hiding this comment.
I would put these parameters in the result logger config rather than in a file.
| message only and skips the publish. | ||
| """ | ||
| if verbose != 0: | ||
| print(message) |
Collaborator
There was a problem hiding this comment.
Avoid print() in production code.
| if verbose != 0: | ||
| print(message) | ||
| if verbose < 0: | ||
| print("\n INFO: verbose < 0: Not sending to rabbitmq!\n") |
| def __exit__(self, exc_type, exc_val, exc_tb): | ||
| try: | ||
| self.connection.close() | ||
| except Exception: |
Collaborator
There was a problem hiding this comment.
Catch specific exceptions rather than generic Exception.
| try: | ||
| self.client.send_as_json(results) | ||
| self.logger.debug("Result sent to RabbitMQ") | ||
| except Exception as exc: # noqa: BLE001 |
| self.logger.debug("Result sent to RabbitMQ") | ||
| except Exception as exc: # noqa: BLE001 | ||
| # Emit a warning to the logging system. | ||
| self.logger.warning( |
Collaborator
There was a problem hiding this comment.
Raise ResultLoggerPluginError rather than logging a warning.
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.
Code review checklist: