feature: add alternate algorithm handlers (#240)

* feature: handle all hashrate algorithm conversions for antminers

* feature: handle all hashrate algorithm conversions for auradine

* feature: handle all hashrate algorithm conversions for avalonminers

* feature: handle all hashrate algorithm conversions for bitaxe

* feature: handle all hashrate algorithm conversions for epic

* feature: handle all hashrate algorithm conversions for goldshell

* refactor: clean up imports

* feature: handle all hashrate algorithm conversions for hammer

* feature: handle all hashrate algorithm conversions for iceriver

* feature: handle all hashrate algorithm conversions for innosilicon

* feature: handle all hashrate algorithm conversions for whatsminer

* tests: update tests to check if miners have board, fan, and algo values

* feature: finish updating all miners with boards, fans, and algos

* feature: update algorithm default values

* feature: add algorithm hashrate values

* feature: improve hashrate types, and use `self.algo` inside miners

---------

Co-authored-by: Upstream Data <brett@upstreamdata.ca>
This commit is contained in:
Brett Rowan
2024-11-21 13:44:17 -07:00
committed by GitHub
parent d66739e2c9
commit c00802e311
171 changed files with 2436 additions and 229 deletions

View File

@@ -38,6 +38,48 @@ class MinersTest(unittest.TestCase):
isinstance(miner, MINER_CLASSES[miner_type][miner_model])
)
def test_miner_has_hashboards(self):
warnings.filterwarnings("ignore")
for miner_type in MINER_CLASSES.keys():
for miner_model in MINER_CLASSES[miner_type].keys():
if miner_model is None:
continue
with self.subTest(
msg=f"Test miner has defined hashboards",
miner_type=miner_type,
miner_model=miner_model,
):
miner = MINER_CLASSES[miner_type][miner_model]("127.0.0.1")
self.assertTrue(miner.expected_hashboards is not None)
def test_miner_has_fans(self):
warnings.filterwarnings("ignore")
for miner_type in MINER_CLASSES.keys():
for miner_model in MINER_CLASSES[miner_type].keys():
if miner_model is None:
continue
with self.subTest(
msg=f"Test miner has defined fans",
miner_type=miner_type,
miner_model=miner_model,
):
miner = MINER_CLASSES[miner_type][miner_model]("127.0.0.1")
self.assertTrue(miner.expected_fans is not None)
def test_miner_has_algo(self):
warnings.filterwarnings("ignore")
for miner_type in MINER_CLASSES.keys():
for miner_model in MINER_CLASSES[miner_type].keys():
if miner_model is None:
continue
with self.subTest(
msg=f"Test miner has defined algo",
miner_type=miner_type,
miner_model=miner_model,
):
miner = MINER_CLASSES[miner_type][miner_model]("127.0.0.1")
self.assertTrue(miner.algo is not None)
def test_miner_data_map_keys(self):
keys = sorted(
[

View File

@@ -398,6 +398,6 @@ class TestHammerMiners(unittest.IsolatedAsyncioTestCase):
self.assertEqual(result.api_ver, "3.1")
self.assertEqual(result.fw_ver, "2023-05-28 17-20-35 CST")
self.assertEqual(result.hostname, "Hammer")
self.assertEqual(round(result.hashrate), 5)
self.assertEqual(round(result.hashrate), 4686)
self.assertEqual(result.fans, [Fan(speed=4650), Fan(speed=4500)])
self.assertEqual(result.total_chips, result.expected_chips)