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):
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]:
if not api_version:
try:

View File

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

View File

@@ -130,7 +130,7 @@ class BaseMiner(ABC):
return object.__new__(cls)
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):
return ipaddress.ip_address(self.ip) < ipaddress.ip_address(other.ip)