Unverified Commit f91f97b6 authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

CLI - Integrate system info for node (#199)

Integrate system info for node, add `sb node info` command.
parent ff487387
......@@ -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):
......
# 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
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment