BOS miners are not accurately reporting "is_mining"
Describe the bug BOS miners are not accurately reporting "is_mining"
To Reproduce Steps to reproduce the behavior:
- Get data on a bos miner that is stopped or started
Expected behavior stopped miners should report is_mining false
Desktop (please complete the following information):
- POPOS 22.04
Miner Information (If applicable):
- Any BOS+ v 2024-12-03-0-f4c282cd-24.09.1-plus Additional context narrowed the issue down to braiins_os.py line 1080
async def _is_mining(self, rpc_devdetails: dict = None) -> Optional[bool]:
print("is mining", rpc_devdetails)
if rpc_devdetails is None:
try:
rpc_devdetails = await self.rpc.send_command(
"devdetails", ignore_errors=True, allow_warning=False
)
except APIError:
pass
if rpc_devdetails is not None:
try:
return not rpc_devdetails["STATUS"][0]["Msg"] == "Unavailable"
except LookupError:
pass
rpc_devdetails returning as
Running
is mining {'STATUS': [{'STATUS': 'S', 'When': 1744221151, 'Code': 69, 'Msg': 'Device Details', 'Description': 'BOSer boser-buildroot 0.1.0-e05df053'}], 'DEVDETAILS': [{'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 0, 'Device Path': '', 'Driver': '', 'Frequency': 267, 'ID': 1, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 1', 'Voltage': -51.4888718209661}, {'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 1, 'Device Path': '', 'Driver': '', 'Frequency': 267, 'ID': 2, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 2', 'Voltage': -51.4888718209661}, {'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 2, 'Device Path': '', 'Driver': '', 'Frequency': 267, 'ID': 3, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 3', 'Voltage': -51.4888718209661}], 'id': 1}
Stopped
is mining {'STATUS': [{'STATUS': 'S', 'When': 1744221042, 'Code': 69, 'Msg': 'Device Details', 'Description': 'BOSer boser-buildroot 0.1.0-e05df053'}], 'DEVDETAILS': [{'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 0, 'Device Path': '', 'Driver': '', 'Frequency': 50, 'ID': 1, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 1', 'Voltage': -51.55757927783486}, {'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 1, 'Device Path': '', 'Driver': '', 'Frequency': 50, 'ID': 2, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 2', 'Voltage': -51.55757927783486}, {'Chips': 108, 'Cores': 137808, 'DEVDETAILS': 2, 'Device Path': '', 'Driver': '', 'Frequency': 50, 'ID': 3, 'Kernel': '', 'Model': 'Antminer T21', 'Name': 'HashchainManager 3', 'Voltage': -51.55757927783486}], 'id': 1}
Good to know. Have to find anew place to source that. This AFAIK this was copied from the old bosminer implementation, but it looks like they fixed that...
I am writing to reopen this issue and report a problem related to the incorrect value retrieval of the miner status on an Antminer S9 miner running BOS. The miner status always returns True despite the miner having been paused.
Looking at the keys returned by the devs RPC call (following @Pipperix's PR #395), I noticed that the 5-second hashrate under the key MHS 5s never goes to 0, even after pausing the miner. In contrast, the nominal hashrate under the Nominal MHS key immediately drops to zero as soon as the miner is paused.
Another observation is that the miner's power consumption immediately drops to zero after pausing the miner. The miner's wattage consumption can be retrieved via the tunerstatus RPC call, as the _get_wattage() function already does.
Given this, there are three potential methods for accurately obtaining the miner's status in a manner consistent with RPC calls:
- Checking the nominal hashrate of each individual board.
- Checking the power consumption.
- Checking both (nominal hashrate and power consumption).
Another consideration, which I am not yet aware of, is whether different API versions require different RPC calls, as we could have different responses for different BOS versions.
@b-rowan, does this make sense to you? Are you already aware of different RPC responses for different BOS versions? In your opinion, which method would be the most appropriate to get the miner status?
Thanks
@b-rowan, does this make sense to you? Are you already aware of different RPC responses for different BOS versions? In your opinion, which method would be the most appropriate to get the miner status?
I don't know how this will change across versions, there is definitely some complexity in tracking this. It would be easiest if we could check the real status of the process, but I can't remember specifically how the pause/resume commands affect bosminer. Might be worth sshing in and checking what changes.
Honestly I don't think it matters much about versioning differences though, the newest version for S9 is 22.08.1, which was over 3 years ago, and should have given people plenty of time to upgrade.
Following cross-tests performed on two different miners (S9 and S19j Pro running BOS), the following differences in the Devs RPC call response have emerged:
- S9 Miner (with BOS v22.08.1):
- The "Nominal MHS" key is zero.
- The "MHS 5s" key maintains a high value (approx. 3344).
- S19j Pro Miner (thanks to @pipperix for the data):
- The "Nominal MHS" key has a value greater than zero.
- The "MHS 5s" key is zero.
Furthermore, on my miner, the power consumption response immediately drops to zero after issuing a miner stop request. @Pipperix could you check if you observe the same behavior?
My understanding is that the pyasic implementation for BOS uses the older cgminer-standard RPC calls, whereas Braiins OS appears to have implemented a more modern gRPC-based protocol (as indicated in the API documentation: https://academy.braiins.com/en/braiins-os/papi-bosminer/#usage).
Although the Braiins documentation refers to the cgminer documentation (https://github.com/ckolivas/cgminer/blob/master/API-README), I have not found a direct way to retrieve the miner's operational state reliably by parsing the cgminer RPC call list. @b-rowan, have you previously encountered this integration issue or discrepancy between RPC and gRPC in pyasic?
For our Edge Mining project, I am inclined to solve the state determination problem by deriving the miner's status from its power consumption:
A miner is considered ON if it is drawing power, otherwise it is OFF.
Is this approach equally valid for pyasic, or is it essential to consider a miner ON only if it is producing hashpower (i.e., its hashrate is greater than zero)?
Thanks.
@markoceri
I'm not particular either way, although it may be a good idea to check if the power is above a couple hundred watts, since there may be cases where it reads from the PSU, and the fans draw power even when off.