-
Notifications
You must be signed in to change notification settings - Fork 49
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
Collect system information (New) #760
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #760 +/- ##
==========================================
+ Coverage 36.58% 36.78% +0.20%
==========================================
Files 310 311 +1
Lines 34639 34759 +120
Branches 5965 5976 +11
==========================================
+ Hits 12671 12786 +115
- Misses 21399 21405 +6
+ Partials 569 568 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9cabbdd
to
81116df
Compare
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.
Many things need changing, most of them posted below.
Generally to much unnecessary tight coupling, for something that's practically static.
Now for the whole keeping the state of the session in the state object -> why?
The sysinfo is gathered at the start of the session, and kept there and submitted with the submission. Awesome. But it may be done at the end of the session as well, and wouldn't require any change to the suspend/resume in Checkbox. "what if sysinfo changes during the session", well, with the code submitted here we also wouldn't notice.
23a767b
to
82bcf81
Compare
Getting hw info at the start of the session is IMHO a good idea, to reuse the same data for resources expression (whatever the form of such expression) or to combine one collector with another, or even with the hw manifest. Needless to call again inxi if the data collected at session start can be turned into something jobs requirements can consume. |
1235e7e
to
bdf7720
Compare
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.
I think I found something in need of deletion
Have you tested how it affects other subcommands that create temporary sessions? |
Minor: also port the fix (no reconnecting message) to inxi job
Now the collection is done automatically upon the first get call if no set was done previously. This should be effectively the same as before, the first checkpoint dumps the information, reading it, while a non-fresh session will load a checkpoint setting before reading it Minor: Update tests to mock/check the new path
Minor: moved return_code to output Minor: moved success to property of CollectorOutput Minor: moved str cast to actual cmd Minor: updated tests
Minor: Better metaclass docstr
Minor: exclude build dir from the installation
Minor: updated docstring in init to be up to date to the new content
852d195
to
c04e1d6
Compare
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.
The code looks great. The problem I've got is I think its complexity is unnecessary in places.
It may be best if we sit on it together, so one of two outcomes happen:
- I see what I'm missing, and why the things included here are necessary
- the outputs gets simpler
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.
Monumental work!
Thanks for all the tweaks and improvements!
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
* Init implenation of system info gathering * System information collector init and vendorized inxi * Store actual infos gathered by system_information in the state * Make system_information in state persistent * Include system_information in submission.json * Tests for system_information collectors * Metabox tests to check system_information Minor: also port the fix (no reconnecting message) to inxi job * Updated plainbox tests for new v8 state * Update to overall class style * Test class that resumes the session * Avoid test_assistant's collection of system_information * Test also build_SessionState * Minor: small test for collect * Make system_information executable * Moved responsibility of system_information collection Now the collection is done automatically upon the first get call if no set was done previously. This should be effectively the same as before, the first checkpoint dumps the information, reading it, while a non-fresh session will load a checkpoint setting before reading it Minor: Update tests to mock/check the new path * Refactored Collectors to use metaclasses Minor: moved return_code to output Minor: moved success to property of CollectorOutput Minor: moved str cast to actual cmd Minor: updated tests * Test also CollectorMeta * Change REGISTER_NAME -> COLLECTOR_NAME Minor: Better metaclass docstr * Include inxi in the setup MANIFEST.in Minor: exclude build dir from the installation * Removed success from OutputSuccess and added super * Mock inxi in metabox tests * Removed additional system_information module Minor: updated docstring in init to be up to date to the new content * Documentation about System Information Collection * Fixed paragraphs headers * Address review comments * Rename json_output -> payload * Avoid building json in jinja * Fix typing mistake and update main with the new impl. * Versioned collector outputs Minor: fixed typo * Updated path system_information in vendor * don't jsonify json * Fixed loading mistyping the result of collection
* Init implenation of system info gathering * System information collector init and vendorized inxi * Store actual infos gathered by system_information in the state * Make system_information in state persistent * Include system_information in submission.json * Tests for system_information collectors * Metabox tests to check system_information Minor: also port the fix (no reconnecting message) to inxi job * Updated plainbox tests for new v8 state * Update to overall class style * Test class that resumes the session * Avoid test_assistant's collection of system_information * Test also build_SessionState * Minor: small test for collect * Make system_information executable * Moved responsibility of system_information collection Now the collection is done automatically upon the first get call if no set was done previously. This should be effectively the same as before, the first checkpoint dumps the information, reading it, while a non-fresh session will load a checkpoint setting before reading it Minor: Update tests to mock/check the new path * Refactored Collectors to use metaclasses Minor: moved return_code to output Minor: moved success to property of CollectorOutput Minor: moved str cast to actual cmd Minor: updated tests * Test also CollectorMeta * Change REGISTER_NAME -> COLLECTOR_NAME Minor: Better metaclass docstr * Include inxi in the setup MANIFEST.in Minor: exclude build dir from the installation * Removed success from OutputSuccess and added super * Mock inxi in metabox tests * Removed additional system_information module Minor: updated docstring in init to be up to date to the new content * Documentation about System Information Collection * Fixed paragraphs headers * Address review comments * Rename json_output -> payload * Avoid building json in jinja * Fix typing mistake and update main with the new impl. * Versioned collector outputs Minor: fixed typo * Updated path system_information in vendor * don't jsonify json * Fixed loading mistyping the result of collection
* Init implenation of system info gathering * System information collector init and vendorized inxi * Store actual infos gathered by system_information in the state * Make system_information in state persistent * Include system_information in submission.json * Tests for system_information collectors * Metabox tests to check system_information Minor: also port the fix (no reconnecting message) to inxi job * Updated plainbox tests for new v8 state * Update to overall class style * Test class that resumes the session * Avoid test_assistant's collection of system_information * Test also build_SessionState * Minor: small test for collect * Make system_information executable * Moved responsibility of system_information collection Now the collection is done automatically upon the first get call if no set was done previously. This should be effectively the same as before, the first checkpoint dumps the information, reading it, while a non-fresh session will load a checkpoint setting before reading it Minor: Update tests to mock/check the new path * Refactored Collectors to use metaclasses Minor: moved return_code to output Minor: moved success to property of CollectorOutput Minor: moved str cast to actual cmd Minor: updated tests * Test also CollectorMeta * Change REGISTER_NAME -> COLLECTOR_NAME Minor: Better metaclass docstr * Include inxi in the setup MANIFEST.in Minor: exclude build dir from the installation * Removed success from OutputSuccess and added super * Mock inxi in metabox tests * Removed additional system_information module Minor: updated docstring in init to be up to date to the new content * Documentation about System Information Collection * Fixed paragraphs headers * Address review comments * Rename json_output -> payload * Avoid building json in jinja * Fix typing mistake and update main with the new impl. * Versioned collector outputs Minor: fixed typo * Updated path system_information in vendor * don't jsonify json * Fixed loading mistyping the result of collection
Description
We have decided in CR041 that we are going to rely, among others, on inxi to fetch the hardware of a system. The best place to inject this new step is the bootstrap sequence before any resource job is collected and executed.
This should result in the collection being included as a map in the session storage and dumped at the end of the execution under a new key of the submission.json file in this form:
If a tool runs successfully
If a tool fails or produced an invalid json output:
Resolved issues
Resolves: https://warthogs.atlassian.net/browse/CHECKBOX-900
Documentation
WIP
Tests
The change was tested via metabox both in snaps and source runs