bug: remove boser check in miner_factory, and fix bad syntax on comparison.
This commit is contained in:
@@ -484,15 +484,10 @@ class MinerFactory:
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
boser_enabled = None
|
|
||||||
if miner_type == MinerTypes.BRAIINS_OS:
|
|
||||||
boser_enabled = await self.get_boser_braiins_os(ip)
|
|
||||||
|
|
||||||
miner = self._select_miner_from_classes(
|
miner = self._select_miner_from_classes(
|
||||||
ip,
|
ip,
|
||||||
miner_type=miner_type,
|
miner_type=miner_type,
|
||||||
miner_model=miner_model,
|
miner_model=miner_model,
|
||||||
boser_enabled=boser_enabled,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if miner is not None and not isinstance(miner, UnknownMiner):
|
if miner is not None and not isinstance(miner, UnknownMiner):
|
||||||
@@ -775,13 +770,9 @@ class MinerFactory:
|
|||||||
ip: ipaddress.ip_address,
|
ip: ipaddress.ip_address,
|
||||||
miner_model: Union[str, None],
|
miner_model: Union[str, None],
|
||||||
miner_type: Union[MinerTypes, None],
|
miner_type: Union[MinerTypes, None],
|
||||||
boser_enabled: bool = None,
|
|
||||||
) -> AnyMiner:
|
) -> AnyMiner:
|
||||||
kwargs = {}
|
|
||||||
if boser_enabled is not None:
|
|
||||||
kwargs["boser"] = boser_enabled
|
|
||||||
try:
|
try:
|
||||||
return MINER_CLASSES[miner_type][str(miner_model).upper()](ip, **kwargs)
|
return MINER_CLASSES[miner_type][str(miner_model).upper()](ip)
|
||||||
except LookupError:
|
except LookupError:
|
||||||
if miner_type in MINER_CLASSES:
|
if miner_type in MINER_CLASSES:
|
||||||
return MINER_CLASSES[miner_type][None](ip)
|
return MINER_CLASSES[miner_type][None](ip)
|
||||||
@@ -909,15 +900,6 @@ class MinerFactory:
|
|||||||
except (httpx.HTTPError, LookupError):
|
except (httpx.HTTPError, LookupError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def get_boser_braiins_os(self, ip: str):
|
|
||||||
# TODO: refine this check
|
|
||||||
try:
|
|
||||||
sock_json_data = await self.send_api_command(ip, "version")
|
|
||||||
return sock_json_data["STATUS"][0]["Msg"].split(" ")[0].upper() == "BOSER"
|
|
||||||
except LookupError:
|
|
||||||
# let the bosminer class decide
|
|
||||||
return None
|
|
||||||
|
|
||||||
async def get_miner_model_vnish(self, ip: str) -> Optional[str]:
|
async def get_miner_model_vnish(self, ip: str) -> Optional[str]:
|
||||||
sock_json_data = await self.send_api_command(ip, "stats")
|
sock_json_data = await self.send_api_command(ip, "stats")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -84,14 +84,14 @@ class BOSerWebAPI(BOSMinerWebAPI):
|
|||||||
**parameters: Union[str, int, bool],
|
**parameters: Union[str, int, bool],
|
||||||
) -> dict:
|
) -> dict:
|
||||||
command_type = self.select_command_type(command)
|
command_type = self.select_command_type(command)
|
||||||
if command_type is "gql":
|
if command_type == "gql":
|
||||||
return await self.gql.send_command(command)
|
return await self.gql.send_command(command)
|
||||||
elif command_type is "grpc":
|
elif command_type == "grpc":
|
||||||
try:
|
try:
|
||||||
return await (getattr(self.grpc, command.replace("grpc_", "")))()
|
return await (getattr(self.grpc, command.replace("grpc_", "")))()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise APIError(f"No gRPC command found for command: {command}")
|
raise APIError(f"No gRPC command found for command: {command}")
|
||||||
elif command_type is "luci":
|
elif command_type == "luci":
|
||||||
return await self.luci.send_command(command)
|
return await self.luci.send_command(command)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user