Compare commits

...

7 Commits

Author SHA1 Message Date
b-rowan
1c5c39fa97 version: bump version number. 2024-01-22 18:43:34 -07:00
b-rowan
27c48764a8 refactor: remove miner factory cache. 2024-01-22 18:41:19 -07:00
UpstreamData
5e01f7517b version: bump version number. 2024-01-22 13:39:52 -07:00
b-rowan
569f659fac Merge pull request #96 from fdeh75/fix-vnish-wattage-dimension
Fix vnish wattage dimension
2024-01-22 13:38:27 -07:00
fdeh
dd9c6f1f63 Fix vnish wattage dimension
Update backend vnish.py
2024-01-22 23:17:27 +03:00
b-rowan
0958f47cfe version: bump version number. 2024-01-21 14:39:35 -07:00
b-rowan
3820b40f44 bug: Fix DataLocations defaulting to all get_config. 2024-01-21 14:39:01 -07:00
6 changed files with 14 additions and 16 deletions

View File

@@ -64,6 +64,10 @@ AVALON_DATA_LOC = DataLocations(
"_get_fault_light",
[RPCAPICommand("api_stats", "stats")],
),
str(DataOptions.UPTIME): DataFunction(
"_get_uptime",
[RPCAPICommand("api_stats", "stats")],
),
}
)

View File

@@ -70,6 +70,10 @@ VNISH_DATA_LOC = DataLocations(
"_get_fans",
[RPCAPICommand("api_stats", "stats")],
),
str(DataOptions.UPTIME): DataFunction(
"_get_uptime",
[RPCAPICommand("api_stats", "stats")],
),
}
)
@@ -163,7 +167,7 @@ class VNish(BMMiner):
if web_summary is not None:
try:
wattage = web_summary["miner"]["power_usage"]
wattage = round(wattage * 1000)
wattage = round(wattage)
return wattage
except KeyError:
pass

View File

@@ -89,6 +89,9 @@ class DataFunction:
Union[RPCAPICommand, WebAPICommand, GRPCCommand, GraphQLCommand]
] = field(default_factory=list)
def __call__(self, *args, **kwargs):
return self
DataLocations = make_dataclass(
"DataLocations",
@@ -96,7 +99,7 @@ DataLocations = make_dataclass(
(
enum_value.value,
DataFunction,
field(default_factory=lambda: DataFunction(enum_value.default_command())),
field(default_factory=DataFunction(enum_value.default_command())),
)
for enum_value in DataOptions
],

View File

@@ -411,12 +411,6 @@ async def concurrent_get_first_result(tasks: list, verification_func: Callable):
class MinerFactory:
def __init__(self):
self.cache = {}
def clear_cached_miners(self):
self.cache = {}
async def get_multiple_miners(
self, ips: List[str], limit: int = 200
) -> List[AnyMiner]:
@@ -442,8 +436,6 @@ class MinerFactory:
async def get_miner(self, ip: str):
ip = str(ip)
if ip in self.cache:
return self.cache[ip]
miner_type = None
@@ -491,8 +483,6 @@ class MinerFactory:
miner_model=miner_model,
)
if miner is not None and not isinstance(miner, UnknownMiner):
self.cache[ip] = miner
return miner
async def _get_miner_type(self, ip: str):

View File

@@ -120,9 +120,6 @@ class MinerNetwork:
async def scan_network_for_miners(self) -> List[AnyMiner]:
logging.debug(f"{self} - (Scan Network For Miners) - Scanning")
# clear cached miners
miner_factory.clear_cached_miners()
miners = await asyncio.gather(
*[self.ping_and_get_miner(host) for host in self.hosts]
)

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyasic"
version = "0.48.1"
version = "0.48.4"
description = "A simplified and standardized interface for Bitcoin ASICs."
authors = ["UpstreamData <brett@upstreamdata.ca>"]
repository = "https://github.com/UpstreamData/pyasic"