added restarting and rebooting miner backends

This commit is contained in:
UpstreamData
2022-05-06 15:52:21 -06:00
parent 8215d33241
commit 267c388a95
6 changed files with 82 additions and 21 deletions

View File

@@ -5,11 +5,11 @@ from tools.cfg_util.cfg_util_qt.decorators import disable_buttons
@disable_buttons
async def btn_light(ips: list):
async def btn_light(ip_idxs: list):
table_manager = TableManager()
_table = window["cmd_table"].Widget
iids = _table.get_children()
for idx in ips:
for idx in ip_idxs:
item = _table.item(iids[idx])
ip = item["values"][0]
new_light_val = not table_manager.data[ip]["Light"]
@@ -24,3 +24,39 @@ async def btn_light(ips: list):
else:
table_manager.data[ip]["Command Output"] = "Fault Light command failed."
table_manager.update_tables()
@disable_buttons
async def btn_reboot(ip_idxs: list):
table_manager = TableManager()
_table = window["cmd_table"].Widget
iids = _table.get_children()
for idx in ip_idxs:
item = _table.item(iids[idx])
ip = item["values"][0]
miner = await MinerFactory().get_miner(ip)
success = await miner.reboot()
if success:
table_manager.data[ip]["Command Output"] = "Reboot command succeeded."
else:
table_manager.data[ip]["Command Output"] = "Reboot command failed."
table_manager.update_tables()
@disable_buttons
async def btn_backend(ip_idxs: list):
table_manager = TableManager()
_table = window["cmd_table"].Widget
iids = _table.get_children()
for idx in ip_idxs:
item = _table.item(iids[idx])
ip = item["values"][0]
miner = await MinerFactory().get_miner(ip)
success = await miner.restart_backend()
if success:
table_manager.data[ip][
"Command Output"
] = "Restart Backend command succeeded."
else:
table_manager.data[ip]["Command Output"] = "Restart Backend command failed."
table_manager.update_tables()