changed some printing to logging logs

This commit is contained in:
UpstreamData
2022-04-18 08:49:21 -06:00
committed by UpstreamData
parent ad75b1d25c
commit 4b4d9060ed
3 changed files with 4 additions and 4 deletions

View File

@@ -32,7 +32,6 @@ class MinerNetwork:
return self.network return self.network
if "-" in self.ip_addr: if "-" in self.ip_addr:
print("getting network")
self.network = MinerNetworkRange(self.ip_addr) self.network = MinerNetworkRange(self.ip_addr)
else: else:
# if there is no IP address passed, default to 192.168.1.0 # if there is no IP address passed, default to 192.168.1.0

View File

@@ -1,6 +1,7 @@
from ipaddress import ip_address from ipaddress import ip_address
import asyncio import asyncio
import os import os
import logging
from network import ping_miner from network import ping_miner
from miners.miner_factory import MinerFactory from miners.miner_factory import MinerFactory
@@ -119,7 +120,7 @@ class TestbenchMiner:
await miner.send_file(UPDATE_FILE_S9, "/tmp/firmware.tar") await miner.send_file(UPDATE_FILE_S9, "/tmp/firmware.tar")
await miner.send_ssh_command("sysupgrade /tmp/firmware.tar") await miner.send_ssh_command("sysupgrade /tmp/firmware.tar")
except Exception as e: except Exception as e:
print(e) logging.warning(f"{str(self.host)} Exception: {e}")
await self.add_to_output("Failed to update, restarting.") await self.add_to_output("Failed to update, restarting.")
self.state = START self.state = START
return return

View File

@@ -1,4 +1,5 @@
from fastapi import WebSocket from fastapi import WebSocket
import logging
from miners.miner_factory import MinerFactory from miners.miner_factory import MinerFactory
from tools.web_testbench._network import miner_network from tools.web_testbench._network import miner_network
@@ -17,7 +18,6 @@ class ConnectionManager:
async def connect(self, websocket: WebSocket): async def connect(self, websocket: WebSocket):
await websocket.accept() await websocket.accept()
miners = [] miners = []
print(ConnectionManager.lit_miners)
for host in miner_network.hosts(): for host in miner_network.hosts():
if str(host) in ConnectionManager.lit_miners: if str(host) in ConnectionManager.lit_miners:
miners.append( miners.append(
@@ -32,7 +32,7 @@ class ConnectionManager:
ConnectionManager._connections.append(websocket) ConnectionManager._connections.append(websocket)
def disconnect(self, websocket: WebSocket): def disconnect(self, websocket: WebSocket):
print("Disconnected") logging.info("Disconnected")
ConnectionManager._connections.remove(websocket) ConnectionManager._connections.remove(websocket)
async def broadcast_json(self, data: dict): async def broadcast_json(self, data: dict):