bug: fix some bugs with epic, update miner repr, and remove get_model from braiinsOS.

This commit is contained in:
UpstreamData
2024-01-15 14:58:54 -07:00
parent 707cf8b848
commit c069468803
3 changed files with 14 additions and 20 deletions

View File

@@ -808,11 +808,6 @@ class BOSer(BaseMiner):
except (LookupError, TypeError): except (LookupError, TypeError):
pass pass
async def _get_model(self) -> Optional[str]:
if self.model is not None:
return self.model + " (BOS)"
return "? (BOS)"
async def _get_api_ver(self, api_version: dict = None) -> Optional[str]: async def _get_api_ver(self, api_version: dict = None) -> Optional[str]:
if not api_version: if not api_version:
try: try:

View File

@@ -192,8 +192,7 @@ class ePIC(BaseMiner):
for hb in web_summary["HBs"]: for hb in web_summary["HBs"]:
hashrate += hb["Hashrate"][0] hashrate += hb["Hashrate"][0]
return round(float(float(hashrate / 1000000)), 2) return round(float(float(hashrate / 1000000)), 2)
except (LookupError, ValueError, TypeError) as e: except (LookupError, ValueError, TypeError):
logger.error(e)
pass pass
async def _get_expected_hashrate(self, web_summary: dict = None) -> Optional[float]: async def _get_expected_hashrate(self, web_summary: dict = None) -> Optional[float]:
@@ -207,7 +206,7 @@ class ePIC(BaseMiner):
if web_summary: if web_summary:
try: try:
hashrate = 0 hashrate = 0
if web_summary["HBs"] is not None: if web_summary.get("HBs") is not None:
for hb in web_summary["HBs"]: for hb in web_summary["HBs"]:
if hb["Hashrate"][1] == 0: if hb["Hashrate"][1] == 0:
ideal = 1.0 ideal = 1.0
@@ -216,8 +215,7 @@ class ePIC(BaseMiner):
hashrate += hb["Hashrate"][0] / ideal hashrate += hb["Hashrate"][0] / ideal
return round(float(float(hashrate / 1000000)), 2) return round(float(float(hashrate / 1000000)), 2)
except (LookupError, ValueError, TypeError) as e: except (LookupError, ValueError, TypeError):
logger.error(e)
pass pass
async def _get_fw_ver(self, web_summary: dict = None) -> Optional[str]: async def _get_fw_ver(self, web_summary: dict = None) -> Optional[str]:
@@ -266,7 +264,8 @@ class ePIC(BaseMiner):
HashBoard(slot=i, expected_chips=self.expected_chips) HashBoard(slot=i, expected_chips=self.expected_chips)
for i in range(self.expected_hashboards) for i in range(self.expected_hashboards)
] ]
if web_summary["HBs"] is not None:
if web_summary.get("HBs") is not None:
for hb in web_summary["HBs"]: for hb in web_summary["HBs"]:
for hr in web_hashrate: for hr in web_hashrate:
if hr["Index"] == hb["Index"]: if hr["Index"] == hb["Index"]:
@@ -319,26 +318,26 @@ class ePIC(BaseMiner):
pass pass
return errors return errors
def fault_light_off(self) -> bool: async def fault_light_off(self) -> bool:
return False return False
def fault_light_on(self) -> bool: async def fault_light_on(self) -> bool:
return False return False
def _get_api_ver(self, *args, **kwargs) -> Optional[str]: async def _get_api_ver(self, *args, **kwargs) -> Optional[str]:
pass pass
def _get_env_temp(self, *args, **kwargs) -> Optional[float]: async def _get_env_temp(self, *args, **kwargs) -> Optional[float]:
pass pass
def _get_fan_psu(self, *args, **kwargs) -> Optional[int]: async def _get_fan_psu(self, *args, **kwargs) -> Optional[int]:
pass pass
def _get_wattage_limit(self, *args, **kwargs) -> Optional[int]: async def _get_wattage_limit(self, *args, **kwargs) -> Optional[int]:
pass pass
def send_config(self, config: MinerConfig, user_suffix: str = None) -> None: async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
pass pass
def set_power_limit(self, wattage: int) -> bool: async def set_power_limit(self, wattage: int) -> bool:
return False return False

View File

@@ -130,7 +130,7 @@ class BaseMiner(ABC):
return object.__new__(cls) return object.__new__(cls)
def __repr__(self): def __repr__(self):
return f"{'' if not self.api_type else self.api_type}{'' if not self.model else ' ' + self.model}: {str(self.ip)}" return f"{self.model}: {str(self.ip)}"
def __lt__(self, other): def __lt__(self, other):
return ipaddress.ip_address(self.ip) < ipaddress.ip_address(other.ip) return ipaddress.ip_address(self.ip) < ipaddress.ip_address(other.ip)