Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tsoc
superbenchmark
Commits
8dc19ca4
Unverified
Commit
8dc19ca4
authored
Apr 11, 2022
by
user4543
Committed by
GitHub
Apr 11, 2022
Browse files
CLI - Integrate output all nodes diagnosis results (#339)
**Description** Integrate output all nodes diagnosis results.
parent
55b0f9d2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
4 deletions
+31
-4
docs/cli.md
docs/cli.md
+9
-2
superbench/cli/_commands.py
superbench/cli/_commands.py
+1
-0
superbench/cli/_help.py
superbench/cli/_help.py
+8
-0
superbench/cli/_result_handler.py
superbench/cli/_result_handler.py
+9
-2
tests/cli/test_sb.py
tests/cli/test_sb.py
+4
-0
No files found.
docs/cli.md
View file @
8dc19ca4
...
@@ -173,6 +173,7 @@ sb result diagnosis --baseline-file
...
@@ -173,6 +173,7 @@ sb result diagnosis --baseline-file
--rule-file
--rule-file
[--decimal-place-value]
[--decimal-place-value]
[--rule-file]
[--rule-file]
[--output-all]
[--output-dir]
[--output-dir]
[--output-file-format {excel, json, md, html}]
[--output-file-format {excel, json, md, html}]
```
```
...
@@ -190,6 +191,7 @@ sb result diagnosis --baseline-file
...
@@ -190,6 +191,7 @@ sb result diagnosis --baseline-file
| Name | Default | Description |
| Name | Default | Description |
|-------------------------|---------|-----------------------------------------------------------------------------|
|-------------------------|---------|-----------------------------------------------------------------------------|
|
`--decimal-place-value`
| 2 | Number of valid decimal places to show in output. Default: 2. |
|
`--decimal-place-value`
| 2 | Number of valid decimal places to show in output. Default: 2. |
|
`--output-all`
| N/A | Output diagnosis results for all nodes. |
|
`--output-dir`
|
`None`
| Path to output directory, outputs/{datetime} will be used if not specified. |
|
`--output-dir`
|
`None`
| Path to output directory, outputs/{datetime} will be used if not specified. |
|
`--output-file-format`
|
`excel`
| Format of output file, 'excel', 'json', 'md' or 'html'. Default: excel. |
|
`--output-file-format`
|
`excel`
| Format of output file, 'excel', 'json', 'md' or 'html'. Default: excel. |
...
@@ -216,6 +218,11 @@ Run data diagnosis and output the results in markdown format with 2 valid decima
...
@@ -216,6 +218,11 @@ Run data diagnosis and output the results in markdown format with 2 valid decima
sb result diagnosis --data-file outputs/results-summary.jsonl --rule-file rule.yaml --baseline-file baseline.json --output-file-format md --decimal-place-value 2
sb result diagnosis --data-file outputs/results-summary.jsonl --rule-file rule.yaml --baseline-file baseline.json --output-file-format md --decimal-place-value 2
```
```
run data diagnosis and output the results of all nodes in json format:
```
bash title="SB CLI"
sb result diagnosis --data-file outputs/results-summary.jsonl --rule-file rule.yaml --baseline-file baseline.json --output-file-format json --output-all
```
### `sb result summary`
### `sb result summary`
Generate the readable summary report automatically from benchmarking results according to rules defined in rule file.
Generate the readable summary report automatically from benchmarking results according to rules defined in rule file.
...
@@ -251,12 +258,12 @@ sb result summary --data-file
...
@@ -251,12 +258,12 @@ sb result summary --data-file
#### Examples
#### Examples
Run
data
summary and output the results in markdown format with 2 valid decimal places:
Run
result
summary and output the results in markdown format with 2 valid decimal places:
```
bash title="SB CLI"
```
bash title="SB CLI"
sb result summary --data-file outputs/results-summary.jsonl --rule-file rule.yaml --output-file-format md --decimal-place-value 2
sb result summary --data-file outputs/results-summary.jsonl --rule-file rule.yaml --output-file-format md --decimal-place-value 2
```
```
Run
data diagnosis
and output the results in html format:
Run
result summary
and output the results in html format:
```
bash title="SB CLI"
```
bash title="SB CLI"
sb result summary --data-file outputs/results-summary.jsonl --rule-file rule.yaml --output-file-format html
sb result summary --data-file outputs/results-summary.jsonl --rule-file rule.yaml --output-file-format html
```
```
...
...
superbench/cli/_commands.py
View file @
8dc19ca4
...
@@ -82,5 +82,6 @@ def load_arguments(self, command):
...
@@ -82,5 +82,6 @@ def load_arguments(self, command):
)
)
ac
.
argument
(
'output_file_format'
,
type
=
str
,
help
=
'Format of output file, excel or json.'
)
ac
.
argument
(
'output_file_format'
,
type
=
str
,
help
=
'Format of output file, excel or json.'
)
ac
.
argument
(
'decimal_place_value'
,
type
=
int
,
help
=
'Number of decimal places to show in output.'
)
ac
.
argument
(
'decimal_place_value'
,
type
=
int
,
help
=
'Number of decimal places to show in output.'
)
ac
.
argument
(
'output_all'
,
action
=
'store_true'
,
help
=
'Output results of all nodes.'
)
super
().
load_arguments
(
command
)
super
().
load_arguments
(
command
)
superbench/cli/_help.py
View file @
8dc19ca4
...
@@ -136,6 +136,14 @@
...
@@ -136,6 +136,14 @@
--rule-file rule.yaml
--rule-file rule.yaml
--baseline-file baseline.json
--baseline-file baseline.json
--output-file-format html
--output-file-format html
- name: run data diagnosis and output the results of all nodes in json format
text: >
{cli_name} result diagnosis
--data-file outputs/results-summary.jsonl
--rule-file rule.yaml
--baseline-file baseline.json
--output-file-format json
--output-all
"""
.
format
(
cli_name
=
CLI_NAME
)
"""
.
format
(
cli_name
=
CLI_NAME
)
helps
[
'result summary'
]
=
"""
helps
[
'result summary'
]
=
"""
...
...
superbench/cli/_result_handler.py
View file @
8dc19ca4
...
@@ -12,7 +12,13 @@
...
@@ -12,7 +12,13 @@
def
diagnosis_command_handler
(
def
diagnosis_command_handler
(
raw_data_file
,
rule_file
,
baseline_file
,
output_dir
=
None
,
output_file_format
=
'excel'
,
decimal_place_value
=
2
raw_data_file
,
rule_file
,
baseline_file
,
output_dir
=
None
,
output_file_format
=
'excel'
,
output_all
=
False
,
decimal_place_value
=
2
):
):
"""Run data diagnosis.
"""Run data diagnosis.
...
@@ -22,6 +28,7 @@ def diagnosis_command_handler(
...
@@ -22,6 +28,7 @@ def diagnosis_command_handler(
baseline_file (str): Path to baseline json file.
baseline_file (str): Path to baseline json file.
output_dir (str): Path to output directory.
output_dir (str): Path to output directory.
output_file_format (str): Format of the output file, 'excel', 'json', 'md' or 'html'. Defaults to 'excel'.
output_file_format (str): Format of the output file, 'excel', 'json', 'md' or 'html'. Defaults to 'excel'.
output_all (bool): output diagnosis results for all nodes
decimal_place_value (int): Number of decimal places to show in output.
decimal_place_value (int): Number of decimal places to show in output.
"""
"""
try
:
try
:
...
@@ -36,7 +43,7 @@ def diagnosis_command_handler(
...
@@ -36,7 +43,7 @@ def diagnosis_command_handler(
check_argument_file
(
'baseline_file'
,
baseline_file
)
check_argument_file
(
'baseline_file'
,
baseline_file
)
# Run data diagnosis
# Run data diagnosis
DataDiagnosis
().
run
(
DataDiagnosis
().
run
(
raw_data_file
,
rule_file
,
baseline_file
,
sb_output_dir
,
output_file_format
,
decimal_place_value
raw_data_file
,
rule_file
,
baseline_file
,
sb_output_dir
,
output_file_format
,
output_all
,
decimal_place_value
)
)
except
Exception
as
ex
:
except
Exception
as
ex
:
raise
RuntimeError
(
'Failed to run diagnosis command.'
)
from
ex
raise
RuntimeError
(
'Failed to run diagnosis command.'
)
from
ex
...
...
tests/cli/test_sb.py
View file @
8dc19ca4
...
@@ -110,6 +110,10 @@ def test_sb_result_diagnosis(self):
...
@@ -110,6 +110,10 @@ def test_sb_result_diagnosis(self):
'sb result diagnosis -d {dir}/test_results.jsonl -r {dir}/test_rules.yaml -b {dir}/test_baseline.json'
.
'sb result diagnosis -d {dir}/test_results.jsonl -r {dir}/test_rules.yaml -b {dir}/test_baseline.json'
.
format
(
dir
=
test_analyzer_dir
)
+
' --output-dir outputs/test-diagnosis/'
format
(
dir
=
test_analyzer_dir
)
+
' --output-dir outputs/test-diagnosis/'
)
)
self
.
cmd
(
'sb result diagnosis -d {dir}/test_results.jsonl -r {dir}/test_rules.yaml -b {dir}/test_baseline.json'
.
format
(
dir
=
test_analyzer_dir
)
+
' --output-dir outputs/test-diagnosis/ --output-all'
)
# test invalid output format
# test invalid output format
self
.
cmd
(
self
.
cmd
(
'sb result diagnosis -d {dir}/test_results.jsonl -r {dir}/test_rules.yaml -b {dir}/test_baseline.json'
.
'sb result diagnosis -d {dir}/test_results.jsonl -r {dir}/test_rules.yaml -b {dir}/test_baseline.json'
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment