Skip to content

Commit 6a48259

Browse files
Merge pull request #15 from amd/alex_diff
Create reference config from system settings
2 parents edbb476 + 4fc037f commit 6a48259

30 files changed

+760
-378
lines changed

README.md

Lines changed: 122 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ The Node Scraper CLI can be used to run Node Scraper plugins on a target system.
1717
options are available:
1818

1919
```sh
20-
usage: node-scraper [-h] [--sys-name STRING] [--sys-location {LOCAL,REMOTE}] [--sys-interaction-level {PASSIVE,INTERACTIVE,DISRUPTIVE}] [--sys-sku STRING] [--sys-platform STRING] [--plugin-configs [STRING ...]]
21-
[--system-config STRING] [--connection-config STRING] [--log-path STRING] [--log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}]
20+
usage: node-scraper [-h] [--sys-name STRING] [--sys-location {LOCAL,REMOTE}]
21+
[--sys-interaction-level {PASSIVE,INTERACTIVE,DISRUPTIVE}] [--sys-sku STRING] [--sys-platform STRING]
22+
[--plugin-configs [STRING ...]] [--system-config STRING] [--connection-config STRING] [--log-path STRING]
23+
[--log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}] [--gen-reference-config]
2224
{run-plugins,describe,gen-plugin-config} ...
2325

2426
node scraper CLI
@@ -32,120 +34,60 @@ positional arguments:
3234

3335
options:
3436
-h, --help show this help message and exit
35-
--sys-name STRING System name (default: TheraC55)
37+
--sys-name STRING System name (default: <my_system_name>)
3638
--sys-location {LOCAL,REMOTE}
3739
Location of target system (default: LOCAL)
3840
--sys-interaction-level {PASSIVE,INTERACTIVE,DISRUPTIVE}
39-
Specify system interaction level, used to determine the type of actions that plugins can perform (default: INTERACTIVE)
41+
Specify system interaction level, used to determine the type of actions that plugins can perform (default:
42+
INTERACTIVE)
4043
--sys-sku STRING Manually specify SKU of system (default: None)
4144
--sys-platform STRING
4245
Specify system platform (default: None)
4346
--plugin-configs [STRING ...]
44-
built-in config names or paths to plugin config JSONs. Available built-in configs: NodeStatus (default: None)
47+
built-in config names or paths to plugin config JSONs. Available built-in configs: NodeStatus (default:
48+
None)
4549
--system-config STRING
4650
Path to system config json (default: None)
4751
--connection-config STRING
4852
Path to connection config json (default: None)
4953
--log-path STRING Specifies local path for node scraper logs, use 'None' to disable logging (default: .)
5054
--log-level {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}
5155
Change python log level (default: INFO)
56+
--gen-reference-config
57+
Generate reference config. File will be written to ./reference_config.json. (default: False)
5258

5359
```
5460
55-
The plugins to run can be specified in two ways, using a plugin JSON config file or using the
61+
### Subcommmands
62+
63+
Plugins to run can be specified in two ways, using a plugin JSON config file or using the
5664
'run-plugins' sub command. These two options are not mutually exclusive and can be used together.
5765
58-
---
5966
60-
### Describing Built-in Configs and Plugins
67+
1. **'describe' subcommand**
6168
6269
You can use the `describe` subcommand to display details about built-in configs or plugins.
63-
64-
#### List all built-in configs:
70+
List all built-in configs:
6571
```sh
6672
node-scraper describe config
6773
```
6874
69-
#### Show details for a specific built-in config:
75+
Show details for a specific built-in config
7076
```sh
7177
node-scraper describe config <config-name>
7278
```
7379
74-
#### List all available plugins:
80+
List all available plugins**
7581
```sh
7682
node-scraper describe plugin
7783
```
7884
79-
#### Show details for a specific plugin:
85+
Show details for a specific plugin
8086
```sh
8187
node-scraper describe plugin <plugin-name>
8288
```
8389
84-
---
85-
86-
### Plugin Configs
87-
A plugin JSON config should follow the structure of the plugin config model defined here.
88-
The globals field is a dictionary of global key-value pairs; values in globals will be passed to
89-
any plugin that supports the corresponding key. The plugins field should be a dictionary mapping
90-
plugin names to sub-dictionaries of plugin arguments. Lastly, the result_collators attribute is
91-
used to define result collator classes that will be run on the plugin results. By default, the CLI
92-
adds the TableSummary result collator, which prints a summary of each plugin’s results in a
93-
tabular format to the console.
94-
95-
```json
96-
{
97-
"globals_args": {},
98-
"plugins": {
99-
"BiosPlugin": {
100-
"analysis_args": {
101-
"exp_bios_version": "TestBios123"
102-
}
103-
},
104-
"RocmPlugin": {
105-
"analysis_args": {
106-
"exp_rocm_version": "TestRocm123"
107-
}
108-
}
109-
}
110-
}
111-
```
112-
113-
### 'gen-plugin-config' sub command
114-
The 'gen-plugin-config' sub command can be used to generate a plugin config JSON file for a plugin
115-
or list of plugins that can then be customized. Plugin arguments which have default values will be
116-
prepopulated in the JSON file, arguments without default values will have a value of 'null'.
117-
118-
#### 'gen-plugin-config' Examples
119-
120-
Generate a config for the DmesgPlugin:
121-
```sh
122-
node-scraper gen-plugin-config --plugins DmesgPlugin
123-
```
124-
125-
This would produce the following config:
126-
127-
```json
128-
{
129-
"global_args": {},
130-
"plugins": {
131-
"DmesgPlugin": {
132-
"collection": true,
133-
"analysis": true,
134-
"system_interaction_level": "INTERACTIVE",
135-
"data": null,
136-
"analysis_args": {
137-
"analysis_range_start": null,
138-
"analysis_range_end": null,
139-
"check_unknown_dmesg_errors": true,
140-
"exclude_category": null
141-
}
142-
}
143-
},
144-
"result_collators": {}
145-
}
146-
```
147-
148-
### 'run-plugins' sub command
90+
2. **'run-plugins' sub command**
14991
The plugins to run and their associated arguments can also be specified directly on the CLI using
15092
the 'run-plugins' sub-command. Using this sub-command you can specify a plugin name followed by
15193
the arguments for that particular plugin. Multiple plugins can be specified at once.
@@ -167,7 +109,7 @@ options:
167109

168110
```
169111
170-
#### 'run-plugins' Examples
112+
Examples
171113
172114
Run a single plugin
173115
```sh
@@ -191,8 +133,69 @@ Use plugin configs and 'run-plugins'
191133
node-scraper run-plugins BiosPlugin
192134
```
193135
136+
3. **'gen-plugin-config' sub command**
137+
The 'gen-plugin-config' sub command can be used to generate a plugin config JSON file for a plugin
138+
or list of plugins that can then be customized. Plugin arguments which have default values will be
139+
prepopulated in the JSON file, arguments without default values will have a value of 'null'.
140+
141+
Examples
142+
143+
Generate a config for the DmesgPlugin:
144+
```sh
145+
node-scraper gen-plugin-config --plugins DmesgPlugin
146+
```
147+
148+
This would produce the following config:
149+
150+
```json
151+
{
152+
"global_args": {},
153+
"plugins": {
154+
"DmesgPlugin": {
155+
"collection": true,
156+
"analysis": true,
157+
"system_interaction_level": "INTERACTIVE",
158+
"data": null,
159+
"analysis_args": {
160+
"analysis_range_start": null,
161+
"analysis_range_end": null,
162+
"check_unknown_dmesg_errors": true,
163+
"exclude_category": null
164+
}
165+
}
166+
},
167+
"result_collators": {}
168+
}
169+
```
170+
171+
### Plugin Configs
172+
A plugin JSON config should follow the structure of the plugin config model defined here.
173+
The globals field is a dictionary of global key-value pairs; values in globals will be passed to
174+
any plugin that supports the corresponding key. The plugins field should be a dictionary mapping
175+
plugin names to sub-dictionaries of plugin arguments. Lastly, the result_collators attribute is
176+
used to define result collator classes that will be run on the plugin results. By default, the CLI
177+
adds the TableSummary result collator, which prints a summary of each plugin’s results in a
178+
tabular format to the console.
179+
180+
```json
181+
{
182+
"globals_args": {},
183+
"plugins": {
184+
"BiosPlugin": {
185+
"analysis_args": {
186+
"exp_bios_version": "TestBios123"
187+
}
188+
},
189+
"RocmPlugin": {
190+
"analysis_args": {
191+
"exp_rocm_version": "TestRocm123"
192+
}
193+
}
194+
}
195+
}
196+
```
194197
195-
### '--plugin-configs' example
198+
1. **'--plugin-configs' command**
196199
A plugin config can be used to compare the system data against the config specifications:
197200
```sh
198201
node-scraper --plugin-configs plugin_config.json
@@ -249,3 +252,42 @@ Here is an example of a comprehensive plugin config that specifies analyzer args
249252
"desc": "My golden config"
250253
}
251254
```
255+
256+
2. **'gen-reference-config' command**
257+
This command can be used generate a reference config that is populated with current system
258+
configurations. The plugins that use analyzer args, where applied, will be populated with system
259+
data.
260+
Sample command:
261+
```sh
262+
node-scraper --gen-reference-config run-plugins BiosPlugin OsPlugin
263+
264+
```
265+
This will generate the following config:
266+
```json
267+
{
268+
"global_args": {},
269+
"plugins": {
270+
"BiosPlugin": {
271+
"analysis_args": {
272+
"exp_bios_version": [
273+
"M17"
274+
],
275+
"regex_match": false
276+
}
277+
},
278+
"OsPlugin": {
279+
"analysis_args": {
280+
"exp_os": [
281+
"8.10"
282+
],
283+
"exact_match": true
284+
}
285+
}
286+
},
287+
"result_collators": {}
288+
```
289+
This can be later used on a different platform for comparison, using the steps at #2:
290+
```sh
291+
node-scraper --plugin-configs reference_config.json
292+
293+
```

0 commit comments

Comments
 (0)