Skip to content
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

Optimized training_tool_spec #6151

Merged

Conversation

Formasitchijoh
Copy link
Contributor

@Formasitchijoh Formasitchijoh commented Jan 23, 2025

What this PR does

This PR Optimizes training_tool_spec runtime by removing unnecessary waits and using a module with fewer slides, to reduce the build time of this test group

As of the screenshot below it takes 2min: 25sec to run this test group it started Test suite started at: 2025-01-24 07:54:19 UTC and ended Test suite ended at: 2025-01-24 07:56:34 UTC

After Screen Shot

Screenshot 2025-01-24 at 13 36 23

Notes

  • This optimization is evident in the amount of time it takes to complete this build 31min

@ragesoss
Copy link
Member

Nice. Can you provide some data about which segments of this test file take how much time? 8 minutes for this is still really long, and I don't think it used to be nearly as long as this.

@Formasitchijoh
Copy link
Contributor Author

Nice. Can you provide some data about which segments of this test file take how much time? 8 minutes for this is still really long, and I don't think it used to be nearly as long as this.

Loading the data for the modules seems to take very long, when I ran it locally with my connection disconnected it seemed to pass and took about 2m, when when I reconnected to the internet it took this 8/10 min

I have a question in the TrainingBase class which loads the modules and slides from either from the WikiTrainingLoader or the YamlTrainingLoader
does it mean the WikiTrainingLoader is the remote server?

@ragesoss
Copy link
Member

Is that training loading happening in Wiki Education mode, or Peony mode? WikiTrainingLoader is used in Peony mode, and takes much longer. Ideally, we should find a way to still test that loading from wiki works, process as few modules and slides as possible.

@Formasitchijoh
Copy link
Contributor Author

Formasitchijoh commented Jan 23, 2025

Currently my local is set to the Wiki Education mode, so i guess it is loading in the Wiki Education mode.
is it possible to switch mode when the test is running ?

@ragesoss
Copy link
Member

overall, the code at the top of config/environments/test.rb controls the mode for the test suite. individual tests sometimes override that, usually via allow(Features).to receive(:wiki_ed?).and_return(true).

@Formasitchijoh
Copy link
Contributor Author

overall, the code at the top of config/environments/test.rb controls the mode for the test suite. individual tests sometimes override that, usually via allow(Features).to receive(:wiki_ed?).and_return(true).

Alright I see, but this test does not override this allow(Features).to receive(:wiki_ed?).and_return(true)

@ragesoss
Copy link
Member

Hmm... maybe that can simply be changed. There are two places in training_tool_spec that explicitly deal with allow(Features), and those are related to specific handling of one config versus the other. Everything else in this spec seems (on a quick skim) like it should not depend on which mode is active.

@Formasitchijoh
Copy link
Contributor Author

Formasitchijoh commented Jan 23, 2025

allow(Features)

Yeah switching does not seem to change anything much, I am currently adding some logs to each describe block to give the exact time each block takes

@ragesoss
Copy link
Member

Are you still working this one, or is it ready to merge?

@Formasitchijoh
Copy link
Contributor Author

There are some logs I added I will need to remove that and ping you.

@Formasitchijoh
Copy link
Contributor Author

@ragesoss I think this is ready to be merged

@ragesoss ragesoss merged commit 561ee64 into WikiEducationFoundation:master Jan 27, 2025
1 check passed
@Formasitchijoh Formasitchijoh deleted the refactor-feature-spec branch January 30, 2025 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants