-
Notifications
You must be signed in to change notification settings - Fork 715
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
Improve cache and enable caching of TestbedInfo #2856
Merged
Merged
Conversation
This file contains 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
The original cache implementation uses json to save cached information to file. For objects that cannot be serialized to JSON, they cannot be cached. Another limitation is that the cached facts must be stored under sub-folder specified by hostname. This limited usage of the caching. This change improved caching in these ways: * Replace JSON with pickle to dump and load cached information. Then all object types supported by pickle can be cached. * Use more generic 'zone' to specify sub-folder for cached facts. The zone can be hostname or other string. * When 'testbed-cli.sh deploy-mg' is executed, cleanup all the cached information, not just cached information of current DUT. * Enable caching of TestbedInfo which is also frequently used and less frequently changed. * Updated related documents. Signed-off-by: Xin Wang <[email protected]>
bingwang-ms
approved these changes
Jan 25, 2021
3 tasks
This pull request introduces 1 alert when merging 67f29e2 into 17ec1cc - view on LGTM.com new alerts:
|
lolyu
approved these changes
Jan 25, 2021
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
retest vsimage please |
1 similar comment
retest vsimage please |
wangxin
pushed a commit
that referenced
this pull request
Feb 6, 2021
…xtures (#2811) What is the motivation for this PR? pytest_generate_tests dynamically adds enum_* fixtures that select DUTs on which the tests are to be parameterized. In order to select the DUTs on which the tests are to run, we need to get the TestbedInfo and also all variables defined in the inventory file for each DUT. These operations are time consuming - like creating TestbedInfo taking 1-9 seconds, and getting variables from inventory taking 3-5 seconds. pytest_generate_tests is called for all the tests/fixtures that needs to run in a pytest session. This was adding a long time when trying to execute many tests. This issue was reported in issue #2790 - pytest_generate_tests in tests/conftest.py takes much more time than before How did you do it? To fix this, we need to create the TestbedInfo only once, store it, and then use the stored value in the next execution of pytest_generate_tests, rather than re-creating TestbedInfo. Similary, the variables for all the DUTs in the testbed should be read once from the inventory files, stored, and the re-used in the next execution of pytest_generate_tests. PR #2789 Added caching capability to store any facts using pickle. PR #2856 added caching capability for TestbedInfo PR #2873 added caching capability for variables for DUTs in the inventory files. We use the cached TestbedInfo and DUT variables in the selection of DUTs in pytest_generate_tests. How did you verify/test it? Ran tests that use the dut selection fixtures and validated that the delay is seen only once, and not in every call to pytest_generate_tests. Validated the execution time reduced significantly when using caching when executing iface_namingmode test cases which have ~30 tests.
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.
Description of PR
Summary:
Fixes # (issue)
Type of change
Approach
What is the motivation for this PR?
The original cache implementation uses json to save cached information to file. For objects that
cannot be serialized to JSON, they cannot be cached. Another limitation is that the cached facts
must be stored under sub-folder specified by hostname. This limited usage of the caching.
How did you do it?
This change improved caching in these ways:
How did you verify/test it?
testbed-cli.sh deploy-mg
Any platform specific information?
Supported testbed topology if it's a new test case?
Documentation