Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Errors hashboards VNISH #255

Open
olegudff opened this issue Dec 13, 2024 · 5 comments
Open

Add Errors hashboards VNISH #255

olegudff opened this issue Dec 13, 2024 · 5 comments

Comments

@olegudff
Copy link

olegudff commented Dec 13, 2024

Is your feature request related to a problem? Please describe.
Currently, there is no convenient built-in method for centrally retrieving and processing miner errors when working with VNish firmware. This makes it more difficult to automate monitoring and quickly respond to hardware issues, especially when running large-scale mining operations.

Describe the solution you'd like
I would like to see functionality similar to the _get_errors() method available for other miners, but specifically adapted for VNish firmware. Ideally, it would fetch data from the miner’s /api/v1/summary, parse the state and description fields for each chain, and return a structured list of errors—following the approach used in other parts of the library.

Describe alternatives you've considered
An alternative would be to parse the API data manually outside the library, but that adds complexity and maintenance overhead. Another option would be to rely on external scripts or plugins to handle error processing, which again increases development and maintenance costs.

Additional context
Implementing this feature would make it significantly easier to monitor and manage large fleets of miners. Rapid error detection and reporting are critical for operational stability and reducing downtime, and a built-in method would streamline these processes.

Below is the updated code snippet including the _get_errors method for VNish:
/pyasic/miners/backends/vnish.py

from typing import Optional, List
from pyasic.data.error_codes import MinerErrorData, X19Error

    async def _get_errors(self, web_summary: dict = None) -> List[MinerErrorData]:
        errors = []
        if web_summary is None:
            try:
                web_summary = await self.web.summary()
            except APIError:
                return errors

        if web_summary is not None:
            chains = web_summary.get("miner", {}).get("chains", [])
            for chain in chains:
                state = chain.get("status", {}).get("state")
                description = chain.get("status", {}).get("description", "")
                if state == "failure":
                    errors.append(X19Error(error_message=description))

        return errors

And API json:

{
 "miner": {
   "miner_status": { "miner_state": "stopped", "miner_state_time": 24687 },
   "miner_type": "Antminer S19 (Vnish 1.2.6-rc1)",
   "hr_stock": 95879.0,
   "average_hashrate": 0.0,
   "instant_hashrate": 0.0,
   "hr_realtime": 0.0,
   "hr_nominal": 0.0,
   "hr_average": 0.0,
   "pcb_temp": { "min": 2, "max": 3 },
   "chip_temp": { "min": 12, "max": 13 },
   "power_consumption": 0,
   "power_usage": 0,
   "power_efficiency": 0.0,
   "hw_errors_percent": 0.0,
   "hr_error": 0.0,
   "hw_errors": 382,
   "devfee_percent": 0.0,
   "devfee": 0.0,
   "pools": [
     {
       "id": 0,
       "url": "***",
       "pool_type": "UserPool",
       "user": "*****",
       "status": "active",
       "asic_boost": true,
       "diff": "65.5K",
       "accepted": 0,
       "rejected": 0,
       "stale": 0,
       "ls_diff": 0.0,
       "ls_time": "0",
       "diffa": 0.0,
       "ping": 0
     },
     {
       "id": 1,
       "url": "***",
       "pool_type": "UserPool",
       "user": "*****",
       "status": "working",
       "asic_boost": true,
       "diff": "65.5K",
       "accepted": 0,
       "rejected": 0,
       "stale": 0,
       "ls_diff": 0.0,
       "ls_time": "0",
       "diffa": 0.0,
       "ping": 0
     },
     {
       "id": 2,
       "url": "***",
       "pool_type": "UserPool",
       "user": "*****",
       "status": "working",
       "asic_boost": true,
       "diff": "65.5K",
       "accepted": 0,
       "rejected": 0,
       "stale": 0,
       "ls_diff": 0.0,
       "ls_time": "0",
       "diffa": 0.0,
       "ping": 0
     },
     {
       "id": 3,
       "url": "DevFee",
       "pool_type": "DevFee",
       "user": "*****",
       "status": "working",
       "asic_boost": true,
       "diff": "16.4K",
       "accepted": 0,
       "rejected": 0,
       "stale": 0,
       "ls_diff": 0.0,
       "ls_time": "0",
       "diffa": 0.0,
       "ping": 0
     }
   ],
   "cooling": {
     "fan_num": 4,
     "fans": [
       { "id": 0, "rpm": 1680, "status": "ok", "max_rpm": 6000 },
       { "id": 1, "rpm": 1680, "status": "ok", "max_rpm": 6000 },
       { "id": 2, "rpm": 720, "status": "ok", "max_rpm": 6000 },
       { "id": 3, "rpm": 720, "status": "ok", "max_rpm": 6000 }
     ],
     "settings": { "mode": { "name": "auto" } },
     "fan_duty": 0
   },
   "chains": [
     {
       "id": 1,
       "frequency": 0.0,
       "voltage": 0,
       "power_consumption": 0,
       "hashrate_ideal": 0.0,
       "hashrate_rt": 0.0,
       "hashrate_percentage": 0.0,
       "hr_error": 0.0,
       "hw_errors": 0,
       "pcb_temp": { "min": 2, "max": 2 },
       "chip_temp": { "min": 12, "max": 12 },
       "chip_statuses": { "red": 0, "orange": 0, "grey": 76 },
       "status": { "state": "stopped" }
     },
     {
       "id": 2,
       "frequency": 0.0,
       "voltage": 0,
       "power_consumption": 0,
       "hashrate_ideal": 0.0,
       "hashrate_rt": 0.0,
       "hashrate_percentage": 0.0,
       "hr_error": 0.0,
       "hw_errors": 0,
       "pcb_temp": { "min": 0, "max": 0 },
       "chip_temp": { "min": 0, "max": 0 },
       "chip_statuses": { "red": 0, "orange": 0, "grey": 76 },
       "status": {
         "state": "failure",
         "description": "Failed to set start up voltage"
       }
     },
     {
       "id": 3,
       "frequency": 0.0,
       "voltage": 0,
       "power_consumption": 0,
       "hashrate_ideal": 0.0,
       "hashrate_rt": 0.0,
       "hashrate_percentage": 0.0,
       "hr_error": 0.0,
       "hw_errors": 0,
       "pcb_temp": { "min": 2, "max": 3 },
       "chip_temp": { "min": 12, "max": 13 },
       "chip_statuses": { "red": 0, "orange": 0, "grey": 76 },
       "status": { "state": "stopped" }
     }
   ],
   "found_blocks": 0,
   "best_share": 0
 }
}

attention here:

      {
        "id": 2,
        "frequency": 0.0,
        "voltage": 0,
        "power_consumption": 0,
        "hashrate_ideal": 0.0,
        "hashrate_rt": 0.0,
        "hashrate_percentage": 0.0,
        "hr_error": 0.0,
        "hw_errors": 0,
        "pcb_temp": { "min": 0, "max": 0 },
        "chip_temp": { "min": 0, "max": 0 },
        "chip_statuses": { "red": 0, "orange": 0, "grey": 76 },
        "status": {
          "state": "failure",
          "description": "Failed to set start up voltage"
        }
      },
@olegudff
Copy link
Author

Result:

[X19Error(error_message='Failed to set start up voltage', error_code=0)]

I just don't know how to make the error number

@b-rowan
Copy link
Collaborator

b-rowan commented Dec 13, 2024

Result:


[X19Error(error_message='Failed to set start up voltage', error_code=0)]

I just don't know how to make the error number

The error number isn't important really, it's just there for some firmwares like Whatsminer stock that provide a code instead of a description, so that I can turn that code into a description.

@b-rowan
Copy link
Collaborator

b-rowan commented Dec 13, 2024

You have pretty much done all the work here, you might as well submit a pull request with this update. All you have to do is add the _get_errors function here - https://github.com/UpstreamData/pyasic/blob/master/pyasic/miners/backends/vnish.py

The only other thing to do is to update the VNISH_DATA_LOC dict with the ERRORS function.

Let me know if you have any questions or want me to open the PR, and thanks for the excellent feature request.

@olegudff
Copy link
Author

olegudff commented Dec 16, 2024

You have pretty much done all the work here, you might as well submit a pull request with this update. All you have to do is add the _get_errors function here - https://github.com/UpstreamData/pyasic/blob/master/pyasic/miners/backends/vnish.py

The only other thing to do is to update the VNISH_DATA_LOC dict with the ERRORS function.

Let me know if you have any questions or want me to open the PR, and thanks for the excellent feature request.

Thanks for the clarification! I'd be happy to submit the PR with the changes. Could you please grant me access to open the PR, or let me know if you'd like me to proceed with it on my own? Once I have access, I'll make sure to add the _get_errors function and update the VNISH_DATA_LOC dictionary as requested.

Looking forward to your response!

@b-rowan
Copy link
Collaborator

b-rowan commented Dec 17, 2024

You have pretty much done all the work here, you might as well submit a pull request with this update. All you have to do is add the _get_errors function here - https://github.com/UpstreamData/pyasic/blob/master/pyasic/miners/backends/vnish.py
The only other thing to do is to update the VNISH_DATA_LOC dict with the ERRORS function.
Let me know if you have any questions or want me to open the PR, and thanks for the excellent feature request.

Thanks for the clarification! I'd be happy to submit the PR with the changes. Could you please grant me access to open the PR, or let me know if you'd like me to proceed with it on my own? Once I have access, I'll make sure to add the _get_errors function and update the VNISH_DATA_LOC dictionary as requested.

Looking forward to your response!

Shouldn't need any access? Just fork the project, make the changes on your version, then submit a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants