added a try except block for logging errors per miner in the testbench

This commit is contained in:
UpstreamData
2022-04-19 10:15:12 -06:00
parent c7b7a6e7c5
commit 0739a7f689
2 changed files with 25 additions and 18 deletions

View File

@@ -73,11 +73,14 @@ class TestbenchMiner:
miner = await MinerFactory().get_miner(self.host) miner = await MinerFactory().get_miner(self.host)
await self.add_to_output("Found miner: " + str(miner)) await self.add_to_output("Found miner: " + str(miner))
if isinstance(miner, BOSMinerS9): if isinstance(miner, BOSMinerS9):
if await self.get_bos_version() == self.latest_version: try:
await self.add_to_output( if await self.get_bos_version() == self.latest_version:
f"Already running the latest version of BraiinsOS, {self.latest_version}, configuring." await self.add_to_output(
) f"Already running the latest version of BraiinsOS, {self.latest_version}, configuring."
self.state = REFERRAL )
self.state = REFERRAL
return
except AttributeError:
return return
await self.add_to_output("Already running BraiinsOS, updating.") await self.add_to_output("Already running BraiinsOS, updating.")
self.state = UPDATE self.state = UPDATE
@@ -295,16 +298,19 @@ class TestbenchMiner:
async def install_loop(self): async def install_loop(self):
self.latest_version = sorted(await get_local_versions(), reverse=True)[0] self.latest_version = sorted(await get_local_versions(), reverse=True)[0]
while True: while True:
if self.state == START: try:
self.start_time = None if self.state == START:
await self.install_start() self.start_time = None
if self.state == UNLOCK: await self.install_start()
await self.install_unlock() if self.state == UNLOCK:
if self.state == INSTALL: await self.install_unlock()
await self.do_install() if self.state == INSTALL:
if self.state == UPDATE: await self.do_install()
await self.install_update() if self.state == UPDATE:
if self.state == REFERRAL: await self.install_update()
await self.install_referral() if self.state == REFERRAL:
if self.state == DONE: await self.install_referral()
await self.install_done() if self.state == DONE:
await self.install_done()
except Exception as E:
logging.error(f"{self.host}: {E}")

View File

@@ -1,5 +1,6 @@
from tools.web_testbench.app import app from tools.web_testbench.app import app
import uvicorn import uvicorn
from logger import logger
def main(): def main():
uvicorn.run("web_testbench:app", host="0.0.0.0", port=80) uvicorn.run("web_testbench:app", host="0.0.0.0", port=80)