knapsack_pro-ruby: Queue mode is running much slower than regular mode with Knapsack Pro

I have the command as below to run my rspec tests in queue mode

KNAPSACK_PRO_FIXED_QUEUE_SPLIT=true \
KNAPSACK_PRO_PROJECT_DIR=. \
KNAPSACK_PRO_CI_NODE_TOTAL=$CI_NODE_TOTAL \
KNAPSACK_PRO_CI_NODE_INDEX=$(($CI_NODE_INDEX-1)) \
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC=<the token> \
KNAPSACK_PRO_TEST_FILE_LIST_SOURCE_FILE=tmp/crystalball_prediction \
bundle exec rake "knapsack_pro:queue:rspec[--format documentation --format RspecJunitFormatter --out tmp/rspec.xml]"

It’s been running fine. I found every time before running, knapsack called this API only once with log

D, [2021-05-20T17:27:44.542380 #134] DEBUG -- : [knapsack_pro] POST https://api.knapsackpro.com/v1/build_distributions/subset

to post all the tests, then each node starts to run what they have accepted.

However, recently I made some changes for how to generate my rspec tests file, (which I don’t think it’s important to mention here), but I didn’t change the command above at all. Then the rspec takes much longer to run. During the investigation, I found that I have log like this

D, [2021-05-20T19:52:55.641851 #134] DEBUG -- : [knapsack_pro] POST https://api.knapsackpro.com/v1/queues/queue

before running each spec. I think this is suspicious, but on the other way, the queue mode suppose to do that, right? But then why before I don’t have those queues http calls?

Please help!!!

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (13 by maintainers)

Most upvoted comments

Hi @ArturT , thanks for the improvement. I have tested, it did improve a lot. I will just need to improve my prediction file structure a little bit to make it even better. Much appreciated.

Hi @Neal910 I’ve improved Knapsack Pro Queue API and it tracks now all ever recorded test file paths. Thanks to that when you frequently change the set of tests then our API still can use historical data about the test file path time execution to properly group in batches set of tests when knapsack_pro gem pulls the test files from the Queue API.

Please let me know if you see better results in Queue Mode now. Please run at least one CI build with all test file paths so their time execution can be tracked for the very first time before you start using a frequently changing set of test files.