-
Notifications
You must be signed in to change notification settings - Fork 26
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
load_test: update the Queue class provider to work well on MacOS #92
Conversation
WalkthroughThe changes modify Changes
Sequence Diagram(s)sequenceDiagram
participant Main as Main Script
participant Manager as MP Manager
participant Worker as Worker Process
Main->>Manager: Instantiate mp_mgr via mp.Manager()
Main->>Manager: Create logger_q, stop_q, dataset_q using mp_mgr.Queue()
Manager-->>Main: Return shared queues
loop Inter-process communication
Worker->>Manager: Request queue operations (log, stop, dataset tasks)
Manager-->>Worker: Process queue actions
end
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (5)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
load_test.py (1)
126-127
: LGTM! Consider documenting the MacOS compatibility fix.The migration to manager-based queues is well-implemented. Consider adding a comment explaining why manager-based queues are used to help future maintainers understand the MacOS compatibility consideration.
+ # Use manager-based queues for better MacOS compatibility stop_q = mp_mgr.Queue(1) dataset_q = mp_mgr.Queue()
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
load_test.py
(1 hunks)
🔇 Additional comments (2)
load_test.py (2)
119-119
: LGTM! Good solution for MacOS compatibility.Using a multiprocessing Manager is a robust solution for handling shared queues across processes on MacOS, where the default Queue implementation can sometimes raise NotImplementedError.
122-122
: LGTM! Consistent queue management.The logger queue is correctly migrated to use the multiprocessing manager, maintaining consistent queue management across the application.
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.
LGTM
load_test.py
Outdated
@@ -116,13 +116,15 @@ def main(args): | |||
"""Load test CLI entrypoint.""" | |||
args = utils.parse_args(args) | |||
|
|||
mp_mgr = mp.Manager() |
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.
I think if we are using the manager class instead of context-based multi-processing, we should also use it to spin new processes (line #152). Have you tried using mp_mgr
for the create_procs
?
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.
good catch Nikhil. I followed the other suggestion.
Makes it easier to run the load test. And the executable flag is already set.
I updated the code to follow @npalaska's suggestion, and I added a shebang header to make it easier to launch the load test manually. Tested on MacOS. |
@npalaska @sjmonson @dagrayvid any other feedback? good to merge? |
lgtm! |
great, thanks 🎉 |
see https://stackoverflow.com/questions/65609529/python-multiprocessing-queue-notimplementederror-macos
Summary by CodeRabbit