Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c5c39fa97 | ||
|
|
27c48764a8 | ||
|
|
5e01f7517b | ||
|
|
569f659fac | ||
|
|
dd9c6f1f63 | ||
|
|
0958f47cfe | ||
|
|
3820b40f44 |
@@ -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")],
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
],
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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]
|
||||
)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user