feature: add chip counts for M30S++VH50.
This commit is contained in:
@@ -174,10 +174,7 @@ class M30SPlusPlusVH50(WhatsMiner): # noqa - ignore ABC method implementation
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.model = "M30S++ VH50"
|
self.model = "M30S++ VH50"
|
||||||
self.nominal_chips = 0
|
self.nominal_chips = 74
|
||||||
warnings.warn(
|
|
||||||
"Unknown chip count for miner type M30S++ VH50, please open an issue on GitHub (https://github.com/UpstreamData/pyasic)."
|
|
||||||
)
|
|
||||||
self.fan_count = 2
|
self.fan_count = 2
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ class BaseMiner(ABC):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
async def resume_mining(self) -> bool:
|
async def resume_mining(self) -> bool:
|
||||||
"""Stop the mining process of the miner.
|
"""Resume the mining process of the miner.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A boolean value of the success of resuming the mining process.
|
A boolean value of the success of resuming the mining process.
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from tests.config_tests import ConfigTest
|
|
||||||
from tests.miners_tests import MinerFactoryTest, MinersTest
|
from tests.miners_tests import MinerFactoryTest, MinersTest
|
||||||
from tests.network_tests import NetworkTest
|
from tests.network_tests import NetworkTest
|
||||||
|
|
||||||
|
|||||||
@@ -1,113 +0,0 @@
|
|||||||
# ------------------------------------------------------------------------------
|
|
||||||
# Copyright 2022 Upstream Data Inc -
|
|
||||||
# -
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); -
|
|
||||||
# you may not use this file except in compliance with the License. -
|
|
||||||
# You may obtain a copy of the License at -
|
|
||||||
# -
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0 -
|
|
||||||
# -
|
|
||||||
# Unless required by applicable law or agreed to in writing, software -
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS, -
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
|
|
||||||
# See the License for the specific language governing permissions and -
|
|
||||||
# limitations under the License. -
|
|
||||||
# ------------------------------------------------------------------------------
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
from pyasic.config import MinerConfig, _Pool, _PoolGroup # noqa
|
|
||||||
from tests.test_data import (
|
|
||||||
bosminer_api_pools,
|
|
||||||
bosminer_config_pools,
|
|
||||||
x19_api_pools,
|
|
||||||
x19_web_pools,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigTest(unittest.TestCase):
|
|
||||||
def setUp(self) -> None:
|
|
||||||
self.test_config = MinerConfig(
|
|
||||||
pool_groups=[
|
|
||||||
_PoolGroup(
|
|
||||||
quota=1,
|
|
||||||
group_name="TEST",
|
|
||||||
pools=[
|
|
||||||
_Pool(
|
|
||||||
url="stratum+tcp://pyasic.testpool_1.pool:3333",
|
|
||||||
username="pyasic.test",
|
|
||||||
password="123",
|
|
||||||
),
|
|
||||||
_Pool(
|
|
||||||
url="stratum+tcp://pyasic.testpool_2.pool:3333",
|
|
||||||
username="pyasic.test",
|
|
||||||
password="123",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
temp_mode="auto",
|
|
||||||
temp_target=70.0,
|
|
||||||
temp_hot=80.0,
|
|
||||||
temp_dangerous=100.0,
|
|
||||||
fan_speed=None,
|
|
||||||
autotuning_enabled=True,
|
|
||||||
autotuning_wattage=900,
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_config_from_raw(self):
|
|
||||||
bos_config = MinerConfig().from_raw(bosminer_config_pools)
|
|
||||||
bos_config.pool_groups[0].group_name = "TEST"
|
|
||||||
|
|
||||||
with self.subTest(
|
|
||||||
msg="Testing BOSMiner config file config.", bos_config=bos_config
|
|
||||||
):
|
|
||||||
self.assertEqual(bos_config, self.test_config)
|
|
||||||
|
|
||||||
x19_cfg = MinerConfig().from_raw(x19_web_pools)
|
|
||||||
x19_cfg.pool_groups[0].group_name = "TEST"
|
|
||||||
|
|
||||||
with self.subTest(msg="Testing X19 API config.", x19_cfg=x19_cfg):
|
|
||||||
self.assertEqual(x19_cfg, self.test_config)
|
|
||||||
|
|
||||||
def test_config_from_api(self):
|
|
||||||
bos_cfg = MinerConfig().from_api(bosminer_api_pools["POOLS"])
|
|
||||||
bos_cfg.pool_groups[0].group_name = "TEST"
|
|
||||||
|
|
||||||
with self.subTest(msg="Testing BOSMiner API config.", bos_cfg=bos_cfg):
|
|
||||||
self.assertEqual(bos_cfg, self.test_config)
|
|
||||||
|
|
||||||
x19_cfg = MinerConfig().from_api(x19_api_pools["POOLS"])
|
|
||||||
x19_cfg.pool_groups[0].group_name = "TEST"
|
|
||||||
|
|
||||||
with self.subTest(msg="Testing X19 API config.", x19_cfg=x19_cfg):
|
|
||||||
self.assertEqual(x19_cfg, self.test_config)
|
|
||||||
|
|
||||||
def test_config_as_types(self):
|
|
||||||
cfg = MinerConfig().from_api(bosminer_api_pools["POOLS"])
|
|
||||||
cfg.pool_groups[0].group_name = "TEST"
|
|
||||||
|
|
||||||
commands = [
|
|
||||||
func
|
|
||||||
for func in
|
|
||||||
# each function in self
|
|
||||||
dir(cfg)
|
|
||||||
if callable(getattr(cfg, func)) and
|
|
||||||
# no __ methods
|
|
||||||
not func.startswith("__")
|
|
||||||
]
|
|
||||||
|
|
||||||
for command in [cmd for cmd in commands if cmd.startswith("as_")]:
|
|
||||||
with self.subTest():
|
|
||||||
output = getattr(cfg, command)()
|
|
||||||
self.assertEqual(output, getattr(self.test_config, command)())
|
|
||||||
if f"from_{command.split('as_')[1]}" in commands:
|
|
||||||
self.assertEqual(
|
|
||||||
getattr(MinerConfig(), f"from_{command.split('as_')[1]}")(
|
|
||||||
output
|
|
||||||
),
|
|
||||||
self.test_config,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
unittest.main()
|
|
||||||
Reference in New Issue
Block a user