feature: swap from @dataclass to pydantic BaseModel (#238)
* feature: switch almost everything to pydantic BaseModel * feature: swap more dataclasses over to pydantic models * feature: use more model serializers to make data handle better * bug: fix some serialization issues with `None` values * bug: fix some initialization problems with miner mode config * bug: fix new BOS+ pool parsing * bug: fix new BOS+ board temperature parsing serialization error * bug: more misc fixes with serialization, extra methods, and hashrate types * bug: add explicit type conversions to hashrate types * bug: fix epic pool URL parsing * bug: fix positional args in hashboards * bug: fix epic missing url scheme * convert board temp to int --------- Co-authored-by: Upstream Data <brett@upstreamdata.ca> Co-authored-by: John-Paul Compagnone <jpcompagnone@epicblockchain.io>
This commit is contained in:
@@ -187,11 +187,13 @@ class Innosilicon(CGMiner):
|
||||
try:
|
||||
if "Hash Rate H" in web_get_all["total_hash"].keys():
|
||||
return AlgoHashRate.SHA256(
|
||||
web_get_all["total_hash"]["Hash Rate H"], HashUnit.SHA256.H
|
||||
rate=float(web_get_all["total_hash"]["Hash Rate H"]),
|
||||
unit=HashUnit.SHA256.H,
|
||||
).into(self.algo.unit.default)
|
||||
elif "Hash Rate" in web_get_all["total_hash"].keys():
|
||||
return AlgoHashRate.SHA256(
|
||||
web_get_all["total_hash"]["Hash Rate"], HashUnit.SHA256.MH
|
||||
rate=float(web_get_all["total_hash"]["Hash Rate"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except KeyError:
|
||||
pass
|
||||
@@ -199,7 +201,8 @@ class Innosilicon(CGMiner):
|
||||
if rpc_summary is not None:
|
||||
try:
|
||||
return AlgoHashRate.SHA256(
|
||||
rpc_summary["SUMMARY"][0]["MHS 1m"], HashUnit.SHA256.MH
|
||||
rate=float(rpc_summary["SUMMARY"][0]["MHS 1m"]),
|
||||
unit=HashUnit.SHA256.MH,
|
||||
).into(self.algo.unit.default)
|
||||
except (KeyError, IndexError):
|
||||
pass
|
||||
@@ -253,7 +256,7 @@ class Innosilicon(CGMiner):
|
||||
hashrate = board.get("Hash Rate H")
|
||||
if hashrate:
|
||||
hashboards[idx].hashrate = AlgoHashRate.SHA256(
|
||||
hashrate, HashUnit.SHA256.H
|
||||
rate=float(hashrate), unit=HashUnit.SHA256.H
|
||||
).into(self.algo.unit.default)
|
||||
|
||||
chip_temp = board.get("Temp max")
|
||||
|
||||
Reference in New Issue
Block a user