bug: fix issues with bosminer multicommand, and update X17 to use BOSMiner instead of BOSer.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()))
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user