Compare commits

..

7 Commits

Author SHA1 Message Date
b-rowan
e9751d6cd1 version: bump version number. 2024-01-22 19:54:52 -07:00
b-rowan
e2b0a76e67 bug: fix unneeded error handling when getting hostname fails. 2024-01-22 19:40:07 -07:00
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
5 changed files with 4 additions and 15 deletions

View File

@@ -334,6 +334,8 @@ class BOSMiner(BaseMiner):
async def _get_hostname(self) -> Union[str, None]:
try:
hostname = (await self.ssh.get_hostname()).strip()
except AttributeError:
return None
except Exception as e:
logging.error(f"{self} - Getting hostname failed: {e}")
return None

View File

@@ -167,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

@@ -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.2"
version = "0.48.5"
description = "A simplified and standardized interface for Bitcoin ASICs."
authors = ["UpstreamData <brett@upstreamdata.ca>"]
repository = "https://github.com/UpstreamData/pyasic"