fixed some bugs with running the web app from docker

This commit is contained in:
UpstreamData
2022-03-09 10:53:26 -07:00
parent b3103ae700
commit bfc5668d24
8 changed files with 10 additions and 16 deletions

View File

@@ -106,7 +106,7 @@ class MinerFactory:
miner = CGMinerS9(str(ip)) miner = CGMinerS9(str(ip))
elif "BMMiner" in api: elif "BMMiner" in api:
miner = BMMinerS9(str(ip)) miner = BMMinerS9(str(ip))
elif "Antminer T9" in model: elif "Antminer T9" in model:
if "BMMiner" in api: if "BMMiner" in api:
if "Hiveon" in model: if "Hiveon" in model:
@@ -227,24 +227,18 @@ class MinerFactory:
return model return model
# if there are errors, we just return None # if there are errors, we just return None
except APIError: except APIError as e:
return model print(e)
except OSError as e: except OSError as e:
if e.winerror == 121: print(e)
print(e)
return model
else:
print(ip, e)
return model return model
async def _send_api_command(self, ip: ipaddress.ip_address or str, command: str): async def _send_api_command(self, ip: ipaddress.ip_address or str, command: str):
try: try:
# get reader and writer streams # get reader and writer streams
reader, writer = await asyncio.open_connection(str(ip), 4028) reader, writer = await asyncio.open_connection(str(ip), 4028)
# handle OSError 121
except OSError as e: except OSError as e:
if e.winerror == "121": print(e)
print("Semaphore Timeout has Expired.")
return {} return {}
# create the command # create the command

View File

@@ -3,7 +3,7 @@ from fastapi.responses import RedirectResponse
from tools.web_monitor.template import templates from tools.web_monitor.template import templates
from tools.web_monitor.func import get_current_miner_list from tools.web_monitor.func import get_current_miner_list
from tools.web_monitor.settings.func import get_current_settings, update_settings from tools.web_monitor._settings.func import get_current_settings, update_settings
router = APIRouter() router = APIRouter()

View File

@@ -8,7 +8,7 @@ from fastapi.staticfiles import StaticFiles
from tools.web_monitor.dashboard import router as dashboard_router from tools.web_monitor.dashboard import router as dashboard_router
from tools.web_monitor.miner import router as miner_router from tools.web_monitor.miner import router as miner_router
from tools.web_monitor.scan import router as scan_router from tools.web_monitor.scan import router as scan_router
from tools.web_monitor.settings import router as settings_router from tools.web_monitor._settings import router as settings_router
app = FastAPI() app = FastAPI()

View File

@@ -1,7 +1,7 @@
import asyncio import asyncio
from tools.web_monitor.miner_factory import miner_factory from tools.web_monitor.miner_factory import miner_factory
from tools.web_monitor.settings.func import get_current_settings from tools.web_monitor._settings.func import get_current_settings
async def get_miner_data_dashboard(miner_ip): async def get_miner_data_dashboard(miner_ip):

View File

@@ -5,7 +5,7 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter from fastapi import WebSocket, WebSocketDisconnect, APIRouter
from tools.web_monitor.func import get_current_miner_list from tools.web_monitor.func import get_current_miner_list
from tools.web_monitor.settings.func import get_current_settings from tools.web_monitor._settings.func import get_current_settings
from tools.web_monitor.dashboard.func import get_miner_data_dashboard from tools.web_monitor.dashboard.func import get_miner_data_dashboard

View File

@@ -5,7 +5,7 @@ import websockets.exceptions
from fastapi import WebSocket, WebSocketDisconnect, APIRouter from fastapi import WebSocket, WebSocketDisconnect, APIRouter
from tools.web_monitor.miner_factory import miner_factory from tools.web_monitor.miner_factory import miner_factory
from tools.web_monitor.settings.func import get_current_settings from tools.web_monitor._settings.func import get_current_settings
router = APIRouter() router = APIRouter()