-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve cache and enable caching of TestbedInfo (#2856)
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: * 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. * Enhance the cleanup method to support removing single cached information, cached information of a specified zone, or all cached information. Not just cached file is removed, cached information in memory is also removed. * Updated related documents. How did you verify/test it? Run test scripts that need cache enabled tbinfo and minigraph_facts. Run testbed-cli.sh deploy-mg Signed-off-by: Xin Wang <[email protected]>
- Loading branch information
Showing
4 changed files
with
104 additions
and
62 deletions.
There are no files selected for viewing
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
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
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
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