-
Notifications
You must be signed in to change notification settings - Fork 30
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 RSpec queue runner #226
Conversation
@tubaxenor Thank you for the PR. It looks great. I added an internal ticket to our backlog to review this, test it and update specs. I also enabled CircleCI builds for forked pull requests so we could run tests on this PR. Is it fine if we would like to update something (code, specs, docs) in this PR? I see the option Could you run knapsack_pro based on this fork on your CI for a week or two to ensure there are no edge cases or nothing unexpected happens? Does it help to reduce memory pressure caused by RSpec on CI machines? I suspect memory pressure was bigger when using the RSpec split by test examples feature, how does it look now? |
Hi Artur, I am still running some experiment builds and will get back to you once there are some data comparison to shared. You are more than welcome to make changes to this PR since I probably don't have much context of the spec setup and doc convention etc. I will still make some code changes mostly for the logging part to make the code cleaner and more readable. |
I like the benefits you listed. Keep us informed after you run this on your CI for some time. It would be nice if you could run this for your whole team. You could use the fork conditionally to have the option to quickly disable it for all feature branches in case you discover an unexpected issue. For example, I use env var to decide if I want to use the knapsack_pro gem from the RubyGems or local copy: |
I did find another benefit to doing this. If you have We ended up disabling this during CI. I could see it being a knapsack pro default if there is a good place to set it. (can create a separate issue for it). |
@ngan @tubaxenor Have you had a chance to measure the memory pressure reduction in your project case? I'm curious if you see memory usage reduced by a few %, or maybe something more drastic like 10-50%, which would be a huge win. Thanks. |
@ArturT we ended not measuring memory usage because it was too difficult to do with our test suite size...and we felt that the other benefits only was worth making this change. But we've been using this code for 2 months now and it's been working well. |
@ngan Thanks for the info. We have this PR in our backlog to review it and verify its approach. We also need to sync it with our latest changes in the knapsack_pro gem 6.x around RSpec integration. We will keep you posted with further updates. |
…pro-ruby#226" This reverts commit e4294c2.
@tubaxenor I tested your code to see if it can also help with the issue: I noticed that RSpec ignores the Example command: Your code breaks the expected RSpec behavior because the |
I fixed the issue. The |
We have released version 7.0.0 of the knapsack_pro gem. This version incorporates ideas from this pull request, among other enhancements. Please find the migration steps at the following link: |
Currently rspec queue runner calls
RSpec::Core::Runner#run
multiple times for each batch and have to reset runner multiple times. This PR makes following changes:RSpec::Core::Runner
instance and redorun_specs
to wrap all batches from test file allocatoraccumulator
concept and replaced withknapsack_pro_batches
KnapsackPro::Hooks::Queue.call_before_queue
andKnapsackPro::Hooks::Queue.call_after_queue
, since they should be covered by RSpec suite hooks.