From be45eb740091004b820167fe83647bfc167e3697 Mon Sep 17 00:00:00 2001 From: UpstreamData Date: Tue, 30 Jan 2024 13:34:00 -0700 Subject: [PATCH] bug: fix issues with bosminer multicommand, and update X17 to use BOSMiner instead of BOSer. --- pyasic/miners/antminer/bosminer/X17/S17.py | 10 +++++----- pyasic/miners/antminer/bosminer/X17/T17.py | 8 ++++---- pyasic/web/braiins_os/boser.py | 6 ++++-- pyasic/web/braiins_os/bosminer.py | 8 ++++++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pyasic/miners/antminer/bosminer/X17/S17.py b/pyasic/miners/antminer/bosminer/X17/S17.py index 935af1db..381fa145 100644 --- a/pyasic/miners/antminer/bosminer/X17/S17.py +++ b/pyasic/miners/antminer/bosminer/X17/S17.py @@ -14,21 +14,21 @@ # limitations under the License. - # ------------------------------------------------------------------------------ -from pyasic.miners.backends import BOSer +from pyasic.miners.backends import BOSMiner from pyasic.miners.models import S17, S17e, S17Plus, S17Pro -class BOSMinerS17(BOSer, S17): +class BOSMinerS17(BOSMiner, S17): pass -class BOSMinerS17Plus(BOSer, S17Plus): +class BOSMinerS17Plus(BOSMiner, S17Plus): pass -class BOSMinerS17Pro(BOSer, S17Pro): +class BOSMinerS17Pro(BOSMiner, S17Pro): pass -class BOSMinerS17e(BOSer, S17e): +class BOSMinerS17e(BOSMiner, S17e): pass diff --git a/pyasic/miners/antminer/bosminer/X17/T17.py b/pyasic/miners/antminer/bosminer/X17/T17.py index f58da644..1145a608 100644 --- a/pyasic/miners/antminer/bosminer/X17/T17.py +++ b/pyasic/miners/antminer/bosminer/X17/T17.py @@ -14,17 +14,17 @@ # limitations under the License. - # ------------------------------------------------------------------------------ -from pyasic.miners.backends import BOSer +from pyasic.miners.backends import BOSMiner from pyasic.miners.models import T17, T17e, T17Plus -class BOSMinerT17(BOSer, T17): +class BOSMinerT17(BOSMiner, T17): pass -class BOSMinerT17Plus(BOSer, T17Plus): +class BOSMinerT17Plus(BOSMiner, T17Plus): pass -class BOSMinerT17e(BOSer, T17e): +class BOSMinerT17e(BOSMiner, T17e): pass diff --git a/pyasic/web/braiins_os/boser.py b/pyasic/web/braiins_os/boser.py index e405fd29..53eeb878 100644 --- a/pyasic/web/braiins_os/boser.py +++ b/pyasic/web/braiins_os/boser.py @@ -70,13 +70,15 @@ class BOSerWebAPI(BaseWebAPI): not func.startswith("__") and not func.startswith("_") ] - async def multicommand(self, *commands: str) -> dict: + async def multicommand( + self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True + ) -> dict: result = {"multicommand": True} tasks = {} for command in commands: try: tasks[command] = asyncio.create_task(getattr(self, command)()) - except AttributeError: + except (APIError, AttributeError): result["command"] = {} await asyncio.gather(*list(tasks.values())) diff --git a/pyasic/web/braiins_os/bosminer.py b/pyasic/web/braiins_os/bosminer.py index 5d7c7e40..a0500602 100644 --- a/pyasic/web/braiins_os/bosminer.py +++ b/pyasic/web/braiins_os/bosminer.py @@ -59,10 +59,14 @@ class BOSMinerWebAPI(BaseWebAPI): return {} raise APIError(f"LUCI web command failed: command={command}") - async def multicommand(self, *commands: str) -> dict: + async def multicommand( + self, *commands: str, ignore_errors: bool = False, allow_warning: bool = True + ) -> dict: data = {} for command in commands: - data[command] = await self.send_command(command, ignore_errors=True) + data[command] = await self.send_command( + command, ignore_errors=ignore_errors + ) return data async def auth(self, session: httpx.AsyncClient) -> None: