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
f91f97b6
Unverified
Commit
f91f97b6
authored
Sep 16, 2021
by
Yifan Xiong
Committed by
GitHub
Sep 16, 2021
Browse files
CLI - Integrate system info for node (#199)
Integrate system info for node, add `sb node info` command.
parent
ff487387
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
superbench/cli/_commands.py
superbench/cli/_commands.py
+2
-0
superbench/cli/_node_handler.py
superbench/cli/_node_handler.py
+19
-0
tests/cli/test_sb.py
tests/cli/test_sb.py
+4
-0
No files found.
superbench/cli/_commands.py
View file @
f91f97b6
...
...
@@ -23,6 +23,8 @@ def load_command_table(self, args):
g
.
command
(
'deploy'
,
'deploy_command_handler'
)
g
.
command
(
'exec'
,
'exec_command_handler'
)
g
.
command
(
'run'
,
'run_command_handler'
)
with
CommandGroup
(
self
,
'node'
,
'superbench.cli._node_handler#{}'
)
as
g
:
g
.
command
(
'info'
,
'info_command_handler'
)
return
super
().
load_command_table
(
args
)
def
load_arguments
(
self
,
command
):
...
...
superbench/cli/_node_handler.py
0 → 100644
View file @
f91f97b6
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""SuperBench CLI node subgroup command handler."""
from
superbench.tools
import
SystemInfo
def
info_command_handler
():
"""Get node hardware info.
Returns:
dict: node info.
"""
try
:
info
=
SystemInfo
().
get_all
()
except
Exception
as
ex
:
raise
RuntimeError
(
'Failed to get node info.'
)
from
ex
return
info
tests/cli/test_sb.py
View file @
f91f97b6
...
...
@@ -81,3 +81,7 @@ def test_sb_run_nonexist_host_file(self):
"""Test sb run, --host-file does not exist, should fail."""
result
=
self
.
cmd
(
'sb run --host-file ./nonexist.yaml'
,
expect_failure
=
True
)
self
.
assertEqual
(
result
.
exit_code
,
1
)
def
test_sb_node_info
(
self
):
"""Test sb node info, should fail."""
self
.
cmd
(
'sb node info'
,
expect_failure
=
True
)
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