feature: use betterproto + grpclib.

This commit is contained in:
Upstream Data
2023-12-10 20:10:11 -07:00
parent 1ab39f5873
commit 47c2eb9f0e
23 changed files with 3238 additions and 1111 deletions

View File

@@ -22,6 +22,7 @@ import toml
from pyasic.API.bosminer import BOSMinerAPI from pyasic.API.bosminer import BOSMinerAPI
from pyasic.config import MinerConfig from pyasic.config import MinerConfig
from pyasic.config.mining import MiningModePowerTune
from pyasic.data import Fan, HashBoard from pyasic.data import Fan, HashBoard
from pyasic.data.error_codes import BraiinsOSError, MinerErrorData from pyasic.data.error_codes import BraiinsOSError, MinerErrorData
from pyasic.errors import APIError from pyasic.errors import APIError
@@ -316,16 +317,25 @@ class BOSMiner(BaseMiner):
return self.config return self.config
async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None: async def send_config(self, config: MinerConfig, user_suffix: str = None) -> None:
"""Configures miner with yaml config."""
logging.debug(f"{self}: Sending config.") logging.debug(f"{self}: Sending config.")
self.config = config self.config = config
toml_conf = config.as_bos(
model=self.model.replace(" (BOS)", ""), user_suffix=user_suffix if self.web.grpc is not None:
) await self._send_config_grpc(config, user_suffix)
else:
await self._send_config_bosminer(config, user_suffix)
async def _send_config_grpc(self, config: MinerConfig, user_suffix: str = None):
mining_mode = config.mining_mode
mining_mode
async def _send_config_bosminer(self, config: MinerConfig, user_suffix: str = None):
toml_conf = config.as_bosminer(user_suffix=user_suffix)
try: try:
conn = await self._get_ssh_connection() conn = await self._get_ssh_connection()
except ConnectionError: except ConnectionError as e:
return None raise APIError("SSH connection failed when sending config.") from e
async with conn: async with conn:
# BBB check because bitmain suxx # BBB check because bitmain suxx
bbb_check = await conn.run( bbb_check = await conn.run(
@@ -352,12 +362,13 @@ class BOSMiner(BaseMiner):
logging.debug(f"{self}: BBB restarting bosminer.") logging.debug(f"{self}: BBB restarting bosminer.")
await conn.run("/etc/init.d/S99bosminer start") await conn.run("/etc/init.d/S99bosminer start")
async def set_power_limit(self, wattage: int) -> bool: async def set_power_limit(self, wattage: int) -> bool:
try: try:
cfg = await self.get_config() cfg = await self.get_config()
if cfg is None: if cfg is None:
return False return False
cfg.autotuning_wattage = wattage cfg.mining_mode = MiningModePowerTune(wattage)
await self.send_config(cfg) await self.send_config(cfg)
except Exception as e: except Exception as e:
logging.warning(f"{self} set_power_limit: {e}") logging.warning(f"{self} set_power_limit: {e}")

View File

@@ -14,46 +14,17 @@
# limitations under the License. - # limitations under the License. -
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
import json import json
from datetime import datetime, timedelta from datetime import timedelta
from typing import List, Union from typing import Union
import grpc_requests
import httpx import httpx
from google.protobuf.message import Message from grpclib.client import Channel
from grpc import RpcError
from pyasic import APIError, settings from pyasic import APIError, settings
from pyasic.web import BaseWebAPI from pyasic.web import BaseWebAPI
from pyasic.web.bosminer.proto import ( from .proto.braiins.bos import *
get_auth_service_descriptors, from .proto.braiins.bos.v1 import *
get_service_descriptors, from betterproto import Message
)
from pyasic.web.bosminer.proto.bos.v1.actions_pb2 import ( # noqa: this will be defined
SetLocateDeviceStatusRequest,
)
from pyasic.web.bosminer.proto.bos.v1.authentication_pb2 import ( # noqa: this will be defined
SetPasswordRequest,
)
from pyasic.web.bosminer.proto.bos.v1.common_pb2 import ( # noqa: this will be defined
SaveAction,
)
from pyasic.web.bosminer.proto.bos.v1.cooling_pb2 import ( # noqa: this will be defined
SetImmersionModeRequest,
)
from pyasic.web.bosminer.proto.bos.v1.miner_pb2 import ( # noqa: this will be defined
DisableHashboardsRequest,
EnableHashboardsRequest,
)
from pyasic.web.bosminer.proto.bos.v1.performance_pb2 import ( # noqa: this will be defined
DecrementHashrateTargetRequest,
DecrementPowerTargetRequest,
IncrementHashrateTargetRequest,
IncrementPowerTargetRequest,
SetDefaultHashrateTargetRequest,
SetDefaultPowerTargetRequest,
SetHashrateTargetRequest,
SetPowerTargetRequest,
)
class BOSMinerWebAPI(BaseWebAPI): class BOSMinerWebAPI(BaseWebAPI):
@@ -286,6 +257,20 @@ class BOSMinerLuCIAPI:
return await self.send_command("/cgi-bin/luci/admin/miner/api_status") return await self.send_command("/cgi-bin/luci/admin/miner/api_status")
class BOSMinerGRPCStub(
ApiVersionServiceStub,
AuthenticationServiceStub,
CoolingServiceStub,
ConfigurationServiceStub,
MinerServiceStub,
PoolServiceStub,
LicenseServiceStub,
ActionsServiceStub,
PerformanceServiceStub,
):
pass
class BOSMinerGRPCAPI: class BOSMinerGRPCAPI:
def __init__(self, ip: str, pwd: str): def __init__(self, ip: str, pwd: str):
self.ip = ip self.ip = ip
@@ -321,25 +306,16 @@ class BOSMinerGRPCAPI:
ignore_errors: bool = False, ignore_errors: bool = False,
auth: bool = True, auth: bool = True,
) -> dict: ) -> dict:
service, method = command.split("/")
metadata = [] metadata = []
if auth: if auth:
metadata.append(("authorization", await self.auth())) metadata.append(("authorization", await self.auth()))
async with grpc_requests.StubAsyncClient( async with Channel(self.ip, 50051) as c:
f"{self.ip}:50051", service_descriptors=get_service_descriptors() endpoint = getattr(BOSMinerGRPCStub(c), command)
) as client: if endpoint is None:
await client.register_all_service() if not ignore_errors:
try: raise APIError(f"Command not found - {endpoint}")
return await client.request( return {}
service, return (await endpoint(message, metadata=metadata)).to_pydict()
method,
request=message,
metadata=metadata,
)
except RpcError as e:
if ignore_errors:
return {}
raise APIError(e._details)
async def auth(self): async def auth(self):
if self._auth is not None and self._auth_time - datetime.now() < timedelta( if self._auth is not None and self._auth_time - datetime.now() < timedelta(
@@ -350,100 +326,85 @@ class BOSMinerGRPCAPI:
return self._auth return self._auth
async def _get_auth(self): async def _get_auth(self):
async with grpc_requests.StubAsyncClient( async with Channel(self.ip, 50051) as c:
f"{self.ip}:50051", service_descriptors=get_auth_service_descriptors() req = LoginRequest(username=self.username, password=self.pwd)
) as client: async with c.request(
await client.register_all_service() "/braiins.bos.v1.AuthenticationService/Login",
method_meta = client.get_method_meta( grpclib.const.Cardinality.UNARY_UNARY,
"braiins.bos.v1.AuthenticationService", "Login" type(req),
) LoginResponse,
_request = method_meta.method_type.request_parser( ) as stream:
{"username": self.username, "password": self.pwd}, await stream.send_message(req, end=True)
method_meta.input_type, await stream.recv_initial_metadata()
) auth = stream.initial_metadata.get("authorization")
metadata = await method_meta.handler(_request).initial_metadata() if auth is not None:
self._auth = auth
for key, value in metadata:
if key == "authorization":
self._auth = value
self._auth_time = datetime.now() self._auth_time = datetime.now()
return self._auth return self._auth
async def get_api_version(self): async def get_api_version(self):
return await self.send_command( return await self.send_command(
"braiins.bos.ApiVersionService/GetApiVersion", auth=False "get_api_version", ApiVersionRequest(), auth=False
) )
async def start(self): async def start(self):
return await self.send_command("braiins.bos.v1.ActionsService/Start") return await self.send_command("start", StartRequest())
async def stop(self): async def stop(self):
return await self.send_command("braiins.bos.v1.ActionsService/Stop") return await self.send_command("stop", StopRequest())
async def pause_mining(self): async def pause_mining(self):
return await self.send_command("braiins.bos.v1.ActionsService/PauseMining") return await self.send_command("pause_mining", PauseMiningRequest())
async def resume_mining(self): async def resume_mining(self):
return await self.send_command("braiins.bos.v1.ActionsService/ResumeMining") return await self.send_command("resume_mining", ResumeMiningRequest())
async def restart(self): async def restart(self):
return await self.send_command("braiins.bos.v1.ActionsService/Restart") return await self.send_command("restart", RestartRequest())
async def reboot(self): async def reboot(self):
return await self.send_command("braiins.bos.v1.ActionsService/Reboot") return await self.send_command("reboot", RebootRequest())
async def set_locate_device_status(self, enable: bool): async def set_locate_device_status(self, enable: bool):
message = SetLocateDeviceStatusRequest()
message.enable = enable
return await self.send_command( return await self.send_command(
"braiins.bos.v1.ActionsService/SetLocateDeviceStatus", message=message "set_locate_device_status", SetLocateDeviceStatusRequest(enable=enable)
) )
async def get_locate_device_status(self): async def get_locate_device_status(self):
return await self.send_command( return await self.send_command("get_locate_device_status")
"braiins.bos.v1.ActionsService/GetLocateDeviceStatus"
)
async def set_password(self, password: str = None): async def set_password(self, password: str = None):
message = SetPasswordRequest()
if password:
message.password = password
return await self.send_command( return await self.send_command(
"braiins.bos.v1.AuthenticationService/SetPassword", message=message "set_password", SetPasswordRequest(password=password)
) )
async def get_cooling_state(self): async def get_cooling_state(self):
return await self.send_command("braiins.bos.v1.CoolingService/GetCoolingState") return await self.send_command("get_cooling_state", GetCoolingStateRequest())
async def set_immersion_mode( async def set_immersion_mode(
self, self,
enable: bool, enable: bool,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = SetImmersionModeRequest()
message.enable = enable
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.CoolingService/SetImmersionMode", message=message "set_immersion_mode",
SetImmersionModeRequest(
enable_immersion_mode=enable, save_action=save_action
),
) )
async def get_tuner_state(self): async def get_tuner_state(self):
return await self.send_command( return await self.send_command("get_tuner_state")
"braiins.bos.v1.PerformanceService/GetTunerState"
)
async def list_target_profiles(self): async def list_target_profiles(self):
return await self.send_command( return await self.send_command("list_target_profiles")
"braiins.bos.v1.PerformanceService/ListTargetProfiles"
)
async def set_default_power_target( async def set_default_power_target(
self, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY self, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY
): ):
message = SetDefaultPowerTargetRequest()
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/SetDefaultPowerTarget", message=message "set_default_power_target",
message=SetDefaultPowerTargetRequest(save_action=save_action),
) )
async def set_power_target( async def set_power_target(
@@ -451,11 +412,11 @@ class BOSMinerGRPCAPI:
power_target: int, power_target: int,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = SetPowerTargetRequest()
message.power_target.watt = power_target
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/SetPowerTarget", message=message "set_power_target",
SetPowerTargetRequest(
power_target=Power(watt=power_target), save_action=save_action
),
) )
async def increment_power_target( async def increment_power_target(
@@ -463,12 +424,12 @@ class BOSMinerGRPCAPI:
power_target_increment: int, power_target_increment: int,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = IncrementPowerTargetRequest()
message.power_target_increment.watt = power_target_increment
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/IncrementPowerTarget", message=message "increment_power_target",
message=IncrementPowerTargetRequest(
power_target_increment=Power(watt=power_target_increment),
save_action=save_action,
),
) )
async def decrement_power_target( async def decrement_power_target(
@@ -476,37 +437,33 @@ class BOSMinerGRPCAPI:
power_target_decrement: int, power_target_decrement: int,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = DecrementPowerTargetRequest()
message.power_target_decrement.watt = power_target_decrement
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/DecrementPowerTarget", "decrement_power_target",
message=message, message=DecrementPowerTargetRequest(
power_target_decrement=Power(watt=power_target_decrement),
save_action=save_action,
),
) )
async def set_default_hashrate_target( async def set_default_hashrate_target(
self, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY self, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY
): ):
message = SetDefaultHashrateTargetRequest()
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/SetDefaultHashrateTarget", "set_default_hashrate_target",
message=message, message=SetDefaultHashrateTargetRequest(save_action=save_action),
) )
async def set_hashrate_target( async def set_hashrate_target(
self, self,
hashrate_target: int, hashrate_target: float,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = SetHashrateTargetRequest()
message.hashrate_target.terahash_per_second = hashrate_target
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/SetHashrateTarget", message=message "set_hashrate_target",
SetHashrateTargetRequest(
hashrate_target=TeraHashrate(terahash_per_second=hashrate_target),
save_action=save_action,
),
) )
async def increment_hashrate_target( async def increment_hashrate_target(
@@ -514,15 +471,14 @@ class BOSMinerGRPCAPI:
hashrate_target_increment: int, hashrate_target_increment: int,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = IncrementHashrateTargetRequest()
message.hashrate_target_increment.terahash_per_second = (
hashrate_target_increment
)
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/IncrementHashrateTarget", "increment_hashrate_target",
message=message, IncrementHashrateTargetRequest(
hashrate_target_increment=TeraHashrate(
terahash_per_second=hashrate_target_increment
),
save_action=save_action,
),
) )
async def decrement_hashrate_target( async def decrement_hashrate_target(
@@ -530,18 +486,19 @@ class BOSMinerGRPCAPI:
hashrate_target_decrement: int, hashrate_target_decrement: int,
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = DecrementHashrateTargetRequest()
message.hashrate_target_decrement.terahash_per_second = (
hashrate_target_decrement
)
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/DecrementHashrateTarget", "decrement_hashrate_target",
message=message, DecrementHashrateTargetRequest(
hashrate_target_decrement=TeraHashrate(
terahash_per_second=hashrate_target_decrement
),
save_action=save_action,
),
) )
async def set_dps(self): async def set_dps(
self,
):
raise NotImplementedError raise NotImplementedError
return await self.send_command("braiins.bos.v1.PerformanceService/SetDPS") return await self.send_command("braiins.bos.v1.PerformanceService/SetDPS")
@@ -553,11 +510,11 @@ class BOSMinerGRPCAPI:
async def get_active_performance_mode(self): async def get_active_performance_mode(self):
return await self.send_command( return await self.send_command(
"braiins.bos.v1.PerformanceService/GetActivePerformanceMode" "get_active_performance_mode", GetPerformanceModeRequest()
) )
async def get_pool_groups(self): async def get_pool_groups(self):
return await self.send_command("braiins.bos.v1.PoolService/GetPoolGroups") return await self.send_command("get_pool_groups", GetPoolGroupsRequest())
async def create_pool_group(self): async def create_pool_group(self):
raise NotImplementedError raise NotImplementedError
@@ -573,43 +530,39 @@ class BOSMinerGRPCAPI:
async def get_miner_configuration(self): async def get_miner_configuration(self):
return await self.send_command( return await self.send_command(
"braiins.bos.v1.ConfigurationService/GetMinerConfiguration" "get_miner_configuration", GetMinerConfigurationRequest()
) )
async def get_constraints(self): async def get_constraints(self):
return await self.send_command( return await self.send_command(
"braiins.bos.v1.ConfigurationService/GetConstraints" "get_constraints", GetConstraintsRequest()
) )
async def get_license_state(self): async def get_license_state(self):
return await self.send_command("braiins.bos.v1.LicenseService/GetLicenseState") return await self.send_command("get_license_state", GetLicenseStateRequest())
async def get_miner_status(self): async def get_miner_status(self):
return await self.send_command("braiins.bos.v1.MinerService/GetMinerStatus") return await self.send_command("get_miner_status", GetMinerStatusRequest())
async def get_miner_details(self): async def get_miner_details(self):
return await self.send_command("braiins.bos.v1.MinerService/GetMinerDetails") return await self.send_command("get_miner_details", GetMinerDetailsRequest())
async def get_miner_stats(self): async def get_miner_stats(self):
return await self.send_command("braiins.bos.v1.MinerService/GetMinerStats") return await self.send_command("get_miner_stats", GetMinerStatsRequest())
async def get_hashboards(self): async def get_hashboards(self):
return await self.send_command("braiins.bos.v1.MinerService/GetHashboards") return await self.send_command("get_hashboards", GetHashboardsRequest())
async def get_support_archive(self): async def get_support_archive(self):
return await self.send_command("braiins.bos.v1.MinerService/GetSupportArchive") return await self.send_command("get_support_archive", GetSupportArchiveRequest())
async def enable_hashboards( async def enable_hashboards(
self, self,
hashboard_ids: List[str], hashboard_ids: List[str],
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = EnableHashboardsRequest()
message.hashboard_ids[:] = hashboard_ids
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.MinerService/EnableHashboards", message=message "enable_hashboards", EnableHashboardsRequest(hashboard_ids=hashboard_ids, save_action=save_action)
) )
async def disable_hashboards( async def disable_hashboards(
@@ -617,10 +570,6 @@ class BOSMinerGRPCAPI:
hashboard_ids: List[str], hashboard_ids: List[str],
save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY, save_action: SaveAction = SaveAction.SAVE_ACTION_SAVE_AND_APPLY,
): ):
message = DisableHashboardsRequest()
message.hashboard_ids[:] = hashboard_ids
message.save_action = save_action
return await self.send_command( return await self.send_command(
"braiins.bos.v1.MinerService/DisableHashboards", message=message "disable_hashboards", DisableHashboardsRequest(hashboard_ids=hashboard_ids, save_action=save_action)
) )

View File

@@ -1,54 +0,0 @@
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
from __future__ import annotations
from .bos import version_pb2
from .bos.v1 import (
actions_pb2,
authentication_pb2,
common_pb2,
configuration_pb2,
constraints_pb2,
cooling_pb2,
license_pb2,
miner_pb2,
performance_pb2,
pool_pb2,
units_pb2,
work_pb2,
)
def get_service_descriptors():
return [
*version_pb2.DESCRIPTOR.services_by_name.values(),
*authentication_pb2.DESCRIPTOR.services_by_name.values(),
*actions_pb2.DESCRIPTOR.services_by_name.values(),
*common_pb2.DESCRIPTOR.services_by_name.values(),
*configuration_pb2.DESCRIPTOR.services_by_name.values(),
*constraints_pb2.DESCRIPTOR.services_by_name.values(),
*cooling_pb2.DESCRIPTOR.services_by_name.values(),
*license_pb2.DESCRIPTOR.services_by_name.values(),
*miner_pb2.DESCRIPTOR.services_by_name.values(),
*performance_pb2.DESCRIPTOR.services_by_name.values(),
*pool_pb2.DESCRIPTOR.services_by_name.values(),
*units_pb2.DESCRIPTOR.services_by_name.values(),
*work_pb2.DESCRIPTOR.services_by_name.values(),
]
def get_auth_service_descriptors():
return authentication_pb2.DESCRIPTOR.services_by_name.values()

View File

@@ -1,15 +0,0 @@
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------

View File

@@ -1,15 +0,0 @@
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------

View File

@@ -1,23 +0,0 @@
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
from enum import Enum
class SaveAction(Enum):
UNSPECIFIED = "SaveAction.SAVE_ACTION_UNSPECIFIED"
SAVE = "SaveAction.SAVE_ACTION_SAVE"
SAVE_AND_APPLY = "SaveAction.SAVE_ACTION_SAVE_AND_APPLY"
SAVE_AND_FORCE_APPLY = "SaveAction.SAVE_ACTION_SAVE_AND_FORCE_APPLY"

View File

@@ -1,56 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/actions.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x14\x62os/v1/actions.proto\x12\x0e\x62raiins.bos.v1"\x0e\n\x0cStartRequest"(\n\rStartResponse\x12\x17\n\x0f\x61lready_running\x18\x01 \x01(\x08"\x10\n\x0eRestartRequest"*\n\x0fRestartResponse\x12\x17\n\x0f\x61lready_running\x18\x01 \x01(\x08"\x0f\n\rRebootRequest"\x10\n\x0eRebootResponse"\r\n\x0bStopRequest"\'\n\x0cStopResponse\x12\x17\n\x0f\x61lready_stopped\x18\x01 \x01(\x08"\x14\n\x12PauseMiningRequest"-\n\x13PauseMiningResponse\x12\x16\n\x0e\x61lready_paused\x18\x01 \x01(\x08"\x15\n\x13ResumeMiningRequest".\n\x14ResumeMiningResponse\x12\x16\n\x0e\x61lready_mining\x18\x01 \x01(\x08".\n\x1cSetLocateDeviceStatusRequest\x12\x0e\n\x06\x65nable\x18\x01 \x01(\x08"-\n\x1aLocateDeviceStatusResponse\x12\x0f\n\x07\x65nabled\x18\x01 \x01(\x08"\x1e\n\x1cGetLocateDeviceStatusRequest2\xc7\x05\n\x0e\x41\x63tionsService\x12\x44\n\x05Start\x12\x1c.braiins.bos.v1.StartRequest\x1a\x1d.braiins.bos.v1.StartResponse\x12\x41\n\x04Stop\x12\x1b.braiins.bos.v1.StopRequest\x1a\x1c.braiins.bos.v1.StopResponse\x12V\n\x0bPauseMining\x12".braiins.bos.v1.PauseMiningRequest\x1a#.braiins.bos.v1.PauseMiningResponse\x12Y\n\x0cResumeMining\x12#.braiins.bos.v1.ResumeMiningRequest\x1a$.braiins.bos.v1.ResumeMiningResponse\x12J\n\x07Restart\x12\x1e.braiins.bos.v1.RestartRequest\x1a\x1f.braiins.bos.v1.RestartResponse\x12G\n\x06Reboot\x12\x1d.braiins.bos.v1.RebootRequest\x1a\x1e.braiins.bos.v1.RebootResponse\x12q\n\x15SetLocateDeviceStatus\x12,.braiins.bos.v1.SetLocateDeviceStatusRequest\x1a*.braiins.bos.v1.LocateDeviceStatusResponse\x12q\n\x15GetLocateDeviceStatus\x12,.braiins.bos.v1.GetLocateDeviceStatusRequest\x1a*.braiins.bos.v1.LocateDeviceStatusResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.actions_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_STARTREQUEST"]._serialized_start = 40
_globals["_STARTREQUEST"]._serialized_end = 54
_globals["_STARTRESPONSE"]._serialized_start = 56
_globals["_STARTRESPONSE"]._serialized_end = 96
_globals["_RESTARTREQUEST"]._serialized_start = 98
_globals["_RESTARTREQUEST"]._serialized_end = 114
_globals["_RESTARTRESPONSE"]._serialized_start = 116
_globals["_RESTARTRESPONSE"]._serialized_end = 158
_globals["_REBOOTREQUEST"]._serialized_start = 160
_globals["_REBOOTREQUEST"]._serialized_end = 175
_globals["_REBOOTRESPONSE"]._serialized_start = 177
_globals["_REBOOTRESPONSE"]._serialized_end = 193
_globals["_STOPREQUEST"]._serialized_start = 195
_globals["_STOPREQUEST"]._serialized_end = 208
_globals["_STOPRESPONSE"]._serialized_start = 210
_globals["_STOPRESPONSE"]._serialized_end = 249
_globals["_PAUSEMININGREQUEST"]._serialized_start = 251
_globals["_PAUSEMININGREQUEST"]._serialized_end = 271
_globals["_PAUSEMININGRESPONSE"]._serialized_start = 273
_globals["_PAUSEMININGRESPONSE"]._serialized_end = 318
_globals["_RESUMEMININGREQUEST"]._serialized_start = 320
_globals["_RESUMEMININGREQUEST"]._serialized_end = 341
_globals["_RESUMEMININGRESPONSE"]._serialized_start = 343
_globals["_RESUMEMININGRESPONSE"]._serialized_end = 389
_globals["_SETLOCATEDEVICESTATUSREQUEST"]._serialized_start = 391
_globals["_SETLOCATEDEVICESTATUSREQUEST"]._serialized_end = 437
_globals["_LOCATEDEVICESTATUSRESPONSE"]._serialized_start = 439
_globals["_LOCATEDEVICESTATUSRESPONSE"]._serialized_end = 484
_globals["_GETLOCATEDEVICESTATUSREQUEST"]._serialized_start = 486
_globals["_GETLOCATEDEVICESTATUSREQUEST"]._serialized_end = 516
_globals["_ACTIONSSERVICE"]._serialized_start = 519
_globals["_ACTIONSSERVICE"]._serialized_end = 1230
# @@protoc_insertion_point(module_scope)

View File

@@ -1,36 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/authentication.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x1b\x62os/v1/authentication.proto\x12\x0e\x62raiins.bos.v1"2\n\x0cLoginRequest\x12\x10\n\x08username\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t"\x0f\n\rLoginResponse"8\n\x12SetPasswordRequest\x12\x15\n\x08password\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_password"\x15\n\x13SetPasswordResponse2\xb5\x01\n\x15\x41uthenticationService\x12\x44\n\x05Login\x12\x1c.braiins.bos.v1.LoginRequest\x1a\x1d.braiins.bos.v1.LoginResponse\x12V\n\x0bSetPassword\x12".braiins.bos.v1.SetPasswordRequest\x1a#.braiins.bos.v1.SetPasswordResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(
DESCRIPTOR, "bos.v1.authentication_pb2", _globals
)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_LOGINREQUEST"]._serialized_start = 47
_globals["_LOGINREQUEST"]._serialized_end = 97
_globals["_LOGINRESPONSE"]._serialized_start = 99
_globals["_LOGINRESPONSE"]._serialized_end = 114
_globals["_SETPASSWORDREQUEST"]._serialized_start = 116
_globals["_SETPASSWORDREQUEST"]._serialized_end = 172
_globals["_SETPASSWORDRESPONSE"]._serialized_start = 174
_globals["_SETPASSWORDRESPONSE"]._serialized_end = 195
_globals["_AUTHENTICATIONSERVICE"]._serialized_start = 198
_globals["_AUTHENTICATIONSERVICE"]._serialized_end = 379
# @@protoc_insertion_point(module_scope)

View File

@@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/common.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b"\n\x13\x62os/v1/common.proto\x12\x0e\x62raiins.bos.v1*\x85\x01\n\nSaveAction\x12\x1b\n\x17SAVE_ACTION_UNSPECIFIED\x10\x00\x12\x14\n\x10SAVE_ACTION_SAVE\x10\x01\x12\x1e\n\x1aSAVE_ACTION_SAVE_AND_APPLY\x10\x02\x12$\n SAVE_ACTION_SAVE_AND_FORCE_APPLY\x10\x03\x62\x06proto3"
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.common_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_SAVEACTION"]._serialized_start = 40
_globals["_SAVEACTION"]._serialized_end = 173
# @@protoc_insertion_point(module_scope)

View File

@@ -1,40 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/configuration.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import cooling_pb2 as bos_dot_v1_dot_cooling__pb2
from ...bos.v1 import performance_pb2 as bos_dot_v1_dot_performance__pb2
from ...bos.v1 import pool_pb2 as bos_dot_v1_dot_pool__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x1a\x62os/v1/configuration.proto\x12\x0e\x62raiins.bos.v1\x1a\x14\x62os/v1/cooling.proto\x1a\x18\x62os/v1/performance.proto\x1a\x11\x62os/v1/pool.proto"\x1e\n\x1cGetMinerConfigurationRequest"\xc6\x02\n\x1dGetMinerConfigurationResponse\x12;\n\x0bpool_groups\x18\x01 \x03(\x0b\x32&.braiins.bos.v1.PoolGroupConfiguration\x12\x39\n\x0btemperature\x18\x02 \x01(\x0b\x32$.braiins.bos.v1.CoolingConfiguration\x12\x31\n\x05tuner\x18\x03 \x01(\x0b\x32".braiins.bos.v1.TunerConfiguration\x12-\n\x03\x64ps\x18\x04 \x01(\x0b\x32 .braiins.bos.v1.DPSConfiguration\x12K\n\x10hashboard_config\x18\x05 \x01(\x0b\x32\x31.braiins.bos.v1.HashboardPerformanceConfiguration"\x17\n\x15GetConstraintsRequest"\x95\x02\n\x16GetConstraintsResponse\x12;\n\x11tuner_constraints\x18\x01 \x01(\x0b\x32 .braiins.bos.v1.TunerConstraints\x12?\n\x13\x63ooling_constraints\x18\x02 \x01(\x0b\x32".braiins.bos.v1.CoolingConstraints\x12\x37\n\x0f\x64ps_constraints\x18\x03 \x01(\x0b\x32\x1e.braiins.bos.v1.DPSConstraints\x12\x44\n\x16hashboards_constraints\x18\x04 \x01(\x0b\x32$.braiins.bos.v1.HashboardConstraints2\xed\x01\n\x14\x43onfigurationService\x12t\n\x15GetMinerConfiguration\x12,.braiins.bos.v1.GetMinerConfigurationRequest\x1a-.braiins.bos.v1.GetMinerConfigurationResponse\x12_\n\x0eGetConstraints\x12%.braiins.bos.v1.GetConstraintsRequest\x1a&.braiins.bos.v1.GetConstraintsResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(
DESCRIPTOR, "bos.v1.configuration_pb2", _globals
)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_GETMINERCONFIGURATIONREQUEST"]._serialized_start = 113
_globals["_GETMINERCONFIGURATIONREQUEST"]._serialized_end = 143
_globals["_GETMINERCONFIGURATIONRESPONSE"]._serialized_start = 146
_globals["_GETMINERCONFIGURATIONRESPONSE"]._serialized_end = 472
_globals["_GETCONSTRAINTSREQUEST"]._serialized_start = 474
_globals["_GETCONSTRAINTSREQUEST"]._serialized_end = 497
_globals["_GETCONSTRAINTSRESPONSE"]._serialized_start = 500
_globals["_GETCONSTRAINTSRESPONSE"]._serialized_end = 777
_globals["_CONFIGURATIONSERVICE"]._serialized_start = 780
_globals["_CONFIGURATIONSERVICE"]._serialized_end = 1017
# @@protoc_insertion_point(module_scope)

View File

@@ -1,44 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/constraints.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import units_pb2 as bos_dot_v1_dot_units__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x18\x62os/v1/constraints.proto\x12\x0e\x62raiins.bos.v1\x1a\x12\x62os/v1/units.proto">\n\x11UInt32Constraints\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\r\x12\x0b\n\x03min\x18\x02 \x01(\r\x12\x0b\n\x03max\x18\x03 \x01(\r">\n\x11\x44oubleConstraints\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x01\x12\x0b\n\x03min\x18\x02 \x01(\x01\x12\x0b\n\x03max\x18\x03 \x01(\x01"\x82\x01\n\x10PowerConstraints\x12&\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x15.braiins.bos.v1.Power\x12"\n\x03min\x18\x02 \x01(\x0b\x32\x15.braiins.bos.v1.Power\x12"\n\x03max\x18\x03 \x01(\x0b\x32\x15.braiins.bos.v1.Power"\x9a\x01\n\x13HashrateConstraints\x12-\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x1c.braiins.bos.v1.TeraHashrate\x12)\n\x03min\x18\x02 \x01(\x0b\x32\x1c.braiins.bos.v1.TeraHashrate\x12)\n\x03max\x18\x03 \x01(\x0b\x32\x1c.braiins.bos.v1.TeraHashrate"\x9a\x01\n\x16TemperatureConstraints\x12,\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature\x12(\n\x03min\x18\x02 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature\x12(\n\x03max\x18\x03 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature"$\n\x11\x42ooleanConstraint\x12\x0f\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x08"\x85\x01\n\x13\x44urationConstraints\x12&\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x15.braiins.bos.v1.Hours\x12"\n\x03min\x18\x02 \x01(\x0b\x32\x15.braiins.bos.v1.Hours\x12"\n\x03max\x18\x03 \x01(\x0b\x32\x15.braiins.bos.v1.Hours"\x92\x01\n\x14\x46requencyConstraints\x12*\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x19.braiins.bos.v1.Frequency\x12&\n\x03min\x18\x02 \x01(\x0b\x32\x19.braiins.bos.v1.Frequency\x12&\n\x03max\x18\x03 \x01(\x0b\x32\x19.braiins.bos.v1.Frequency"\x8a\x01\n\x12VoltageConstraints\x12(\n\x07\x64\x65\x66\x61ult\x18\x01 \x01(\x0b\x32\x17.braiins.bos.v1.Voltage\x12$\n\x03min\x18\x02 \x01(\x0b\x32\x17.braiins.bos.v1.Voltage\x12$\n\x03max\x18\x03 \x01(\x0b\x32\x17.braiins.bos.v1.Voltageb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.constraints_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_UINT32CONSTRAINTS"]._serialized_start = 64
_globals["_UINT32CONSTRAINTS"]._serialized_end = 126
_globals["_DOUBLECONSTRAINTS"]._serialized_start = 128
_globals["_DOUBLECONSTRAINTS"]._serialized_end = 190
_globals["_POWERCONSTRAINTS"]._serialized_start = 193
_globals["_POWERCONSTRAINTS"]._serialized_end = 323
_globals["_HASHRATECONSTRAINTS"]._serialized_start = 326
_globals["_HASHRATECONSTRAINTS"]._serialized_end = 480
_globals["_TEMPERATURECONSTRAINTS"]._serialized_start = 483
_globals["_TEMPERATURECONSTRAINTS"]._serialized_end = 637
_globals["_BOOLEANCONSTRAINT"]._serialized_start = 639
_globals["_BOOLEANCONSTRAINT"]._serialized_end = 675
_globals["_DURATIONCONSTRAINTS"]._serialized_start = 678
_globals["_DURATIONCONSTRAINTS"]._serialized_end = 811
_globals["_FREQUENCYCONSTRAINTS"]._serialized_start = 814
_globals["_FREQUENCYCONSTRAINTS"]._serialized_end = 960
_globals["_VOLTAGECONSTRAINTS"]._serialized_start = 963
_globals["_VOLTAGECONSTRAINTS"]._serialized_end = 1101
# @@protoc_insertion_point(module_scope)

View File

@@ -1,56 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/cooling.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import common_pb2 as bos_dot_v1_dot_common__pb2
from ...bos.v1 import constraints_pb2 as bos_dot_v1_dot_constraints__pb2
from ...bos.v1 import units_pb2 as bos_dot_v1_dot_units__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x14\x62os/v1/cooling.proto\x12\x0e\x62raiins.bos.v1\x1a\x13\x62os/v1/common.proto\x1a\x18\x62os/v1/constraints.proto\x1a\x12\x62os/v1/units.proto"\xbc\x01\n\x0f\x43oolingAutoMode\x12\x37\n\x12target_temperature\x18\x01 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature\x12\x34\n\x0fhot_temperature\x18\x02 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature\x12:\n\x15\x64\x61ngerous_temperature\x18\x03 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature"\xb7\x01\n\x11\x43oolingManualMode\x12\x1c\n\x0f\x66\x61n_speed_ratio\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x34\n\x0fhot_temperature\x18\x02 \x01(\x0b\x32\x1b.braiins.bos.v1.Temperature\x12:\n\x15\x64\x61ngerous_temperature\x18\x03 \x01(\x0b\x32\x1b.braiins.bos.v1.TemperatureB\x12\n\x10_fan_speed_ratio"G\n\x13\x43oolingDisabledMode\x12\x1c\n\x0f\x66\x61n_speed_ratio\x18\x01 \x01(\x01H\x00\x88\x01\x01\x42\x12\n\x10_fan_speed_ratio"\xfb\x01\n\x14\x43oolingConfiguration\x12"\n\x15minimum_required_fans\x18\x01 \x01(\rH\x01\x88\x01\x01\x12/\n\x04\x61uto\x18\x02 \x01(\x0b\x32\x1f.braiins.bos.v1.CoolingAutoModeH\x00\x12\x33\n\x06manual\x18\x03 \x01(\x0b\x32!.braiins.bos.v1.CoolingManualModeH\x00\x12\x37\n\x08\x64isabled\x18\x04 \x01(\x0b\x32#.braiins.bos.v1.CoolingDisabledModeH\x00\x42\x06\n\x04modeB\x18\n\x16_minimum_required_fans"\x99\x03\n\x12\x43oolingConstraints\x12\x39\n\x14\x64\x65\x66\x61ult_cooling_mode\x18\x01 \x01(\x0e\x32\x1b.braiins.bos.v1.CoolingMode\x12\x42\n\x12target_temperature\x18\x02 \x01(\x0b\x32&.braiins.bos.v1.TemperatureConstraints\x12?\n\x0fhot_temperature\x18\x03 \x01(\x0b\x32&.braiins.bos.v1.TemperatureConstraints\x12\x45\n\x15\x64\x61ngerous_temperature\x18\x04 \x01(\x0b\x32&.braiins.bos.v1.TemperatureConstraints\x12:\n\x0f\x66\x61n_speed_ratio\x18\x05 \x01(\x0b\x32!.braiins.bos.v1.DoubleConstraints\x12@\n\x15minimum_required_fans\x18\x06 \x01(\x0b\x32!.braiins.bos.v1.UInt32Constraints"s\n\x08\x46\x61nState\x12\x15\n\x08position\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x0b\n\x03rpm\x18\x02 \x01(\r\x12\x1f\n\x12target_speed_ratio\x18\x03 \x01(\x01H\x01\x88\x01\x01\x42\x0b\n\t_positionB\x15\n\x13_target_speed_ratio"\x8f\x01\n\x11TemperatureSensor\x12\x0f\n\x02id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x30\n\x08location\x18\x02 \x01(\x0e\x32\x1e.braiins.bos.v1.SensorLocation\x12\x30\n\x0btemperature\x18\x03 \x01(\x0b\x32\x1b.braiins.bos.v1.TemperatureB\x05\n\x03_id"\x18\n\x16GetCoolingStateRequest"\x81\x01\n\x17GetCoolingStateResponse\x12&\n\x04\x66\x61ns\x18\x01 \x03(\x0b\x32\x18.braiins.bos.v1.FanState\x12>\n\x13highest_temperature\x18\x02 \x01(\x0b\x32!.braiins.bos.v1.TemperatureSensor"i\n\x17SetImmersionModeRequest\x12/\n\x0bsave_action\x18\x01 \x01(\x0e\x32\x1a.braiins.bos.v1.SaveAction\x12\x1d\n\x15\x65nable_immersion_mode\x18\x02 \x01(\x08"2\n\x18SetImmersionModeResponse\x12\x16\n\x0eimmersion_mode\x18\x01 \x01(\x08*v\n\x0b\x43oolingMode\x12\x1c\n\x18\x43OOLING_MODE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x43OOLING_MODE_AUTO\x10\x01\x12\x17\n\x13\x43OOLING_MODE_MANUAL\x10\x02\x12\x19\n\x15\x43OOLING_MODE_DISABLED\x10\x03*d\n\x0eSensorLocation\x12\x1f\n\x1bSENSOR_LOCATION_UNSPECIFIED\x10\x00\x12\x18\n\x14SENSOR_LOCATION_CHIP\x10\x01\x12\x17\n\x13SENSOR_LOCATION_PCB\x10\x02\x32\xdb\x01\n\x0e\x43oolingService\x12\x62\n\x0fGetCoolingState\x12&.braiins.bos.v1.GetCoolingStateRequest\x1a\'.braiins.bos.v1.GetCoolingStateResponse\x12\x65\n\x10SetImmersionMode\x12\'.braiins.bos.v1.SetImmersionModeRequest\x1a(.braiins.bos.v1.SetImmersionModeResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.cooling_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_COOLINGMODE"]._serialized_start = 1803
_globals["_COOLINGMODE"]._serialized_end = 1921
_globals["_SENSORLOCATION"]._serialized_start = 1923
_globals["_SENSORLOCATION"]._serialized_end = 2023
_globals["_COOLINGAUTOMODE"]._serialized_start = 108
_globals["_COOLINGAUTOMODE"]._serialized_end = 296
_globals["_COOLINGMANUALMODE"]._serialized_start = 299
_globals["_COOLINGMANUALMODE"]._serialized_end = 482
_globals["_COOLINGDISABLEDMODE"]._serialized_start = 484
_globals["_COOLINGDISABLEDMODE"]._serialized_end = 555
_globals["_COOLINGCONFIGURATION"]._serialized_start = 558
_globals["_COOLINGCONFIGURATION"]._serialized_end = 809
_globals["_COOLINGCONSTRAINTS"]._serialized_start = 812
_globals["_COOLINGCONSTRAINTS"]._serialized_end = 1221
_globals["_FANSTATE"]._serialized_start = 1223
_globals["_FANSTATE"]._serialized_end = 1338
_globals["_TEMPERATURESENSOR"]._serialized_start = 1341
_globals["_TEMPERATURESENSOR"]._serialized_end = 1484
_globals["_GETCOOLINGSTATEREQUEST"]._serialized_start = 1486
_globals["_GETCOOLINGSTATEREQUEST"]._serialized_end = 1510
_globals["_GETCOOLINGSTATERESPONSE"]._serialized_start = 1513
_globals["_GETCOOLINGSTATERESPONSE"]._serialized_end = 1642
_globals["_SETIMMERSIONMODEREQUEST"]._serialized_start = 1644
_globals["_SETIMMERSIONMODEREQUEST"]._serialized_end = 1749
_globals["_SETIMMERSIONMODERESPONSE"]._serialized_start = 1751
_globals["_SETIMMERSIONMODERESPONSE"]._serialized_end = 1801
_globals["_COOLINGSERVICE"]._serialized_start = 2026
_globals["_COOLINGSERVICE"]._serialized_end = 2245
# @@protoc_insertion_point(module_scope)

View File

@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/license.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import units_pb2 as bos_dot_v1_dot_units__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x14\x62os/v1/license.proto\x12\x0e\x62raiins.bos.v1\x1a\x12\x62os/v1/units.proto")\n\x0bNoneLicense\x12\x1a\n\x12time_to_restricted\x18\x01 \x01(\r"\x10\n\x0eLimitedLicense"\x9a\x01\n\x0cValidLicense\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.braiins.bos.v1.LicenseType\x12\x15\n\rcontract_name\x18\x02 \x01(\t\x12\x1a\n\x12time_to_restricted\x18\x03 \x01(\r\x12,\n\x07\x64\x65v_fee\x18\x04 \x01(\x0b\x32\x1b.braiins.bos.v1.BasesPoints"\x80\x01\n\x0e\x45xpiredLicense\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x1b.braiins.bos.v1.LicenseType\x12\x15\n\rcontract_name\x18\x02 \x01(\t\x12,\n\x07\x64\x65v_fee\x18\x03 \x01(\x0b\x32\x1b.braiins.bos.v1.BasesPoints"\x18\n\x16GetLicenseStateRequest"\xe4\x01\n\x17GetLicenseStateResponse\x12+\n\x04none\x18\x01 \x01(\x0b\x32\x1b.braiins.bos.v1.NoneLicenseH\x00\x12\x31\n\x07limited\x18\x02 \x01(\x0b\x32\x1e.braiins.bos.v1.LimitedLicenseH\x00\x12-\n\x05valid\x18\x03 \x01(\x0b\x32\x1c.braiins.bos.v1.ValidLicenseH\x00\x12\x31\n\x07\x65xpired\x18\x04 \x01(\x0b\x32\x1e.braiins.bos.v1.ExpiredLicenseH\x00\x42\x07\n\x05state*_\n\x0bLicenseType\x12\x1c\n\x18LICENSE_TYPE_UNSPECIFIED\x10\x00\x12\x19\n\x15LICENSE_TYPE_STANDARD\x10\x01\x12\x17\n\x13LICENSE_TYPE_CUSTOM\x10\x02\x32t\n\x0eLicenseService\x12\x62\n\x0fGetLicenseState\x12&.braiins.bos.v1.GetLicenseStateRequest\x1a\'.braiins.bos.v1.GetLicenseStateResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.license_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_LICENSETYPE"]._serialized_start = 666
_globals["_LICENSETYPE"]._serialized_end = 761
_globals["_NONELICENSE"]._serialized_start = 60
_globals["_NONELICENSE"]._serialized_end = 101
_globals["_LIMITEDLICENSE"]._serialized_start = 103
_globals["_LIMITEDLICENSE"]._serialized_end = 119
_globals["_VALIDLICENSE"]._serialized_start = 122
_globals["_VALIDLICENSE"]._serialized_end = 276
_globals["_EXPIREDLICENSE"]._serialized_start = 279
_globals["_EXPIREDLICENSE"]._serialized_end = 407
_globals["_GETLICENSESTATEREQUEST"]._serialized_start = 409
_globals["_GETLICENSESTATEREQUEST"]._serialized_end = 433
_globals["_GETLICENSESTATERESPONSE"]._serialized_start = 436
_globals["_GETLICENSESTATERESPONSE"]._serialized_end = 664
_globals["_LICENSESERVICE"]._serialized_start = 763
_globals["_LICENSESERVICE"]._serialized_end = 879
# @@protoc_insertion_point(module_scope)

File diff suppressed because one or more lines are too long

View File

@@ -1,110 +0,0 @@
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
from dataclasses import asdict, dataclass
from typing import Union
@dataclass
class Frequency:
hertz: float
@dataclass
class Voltage:
volt: float
@dataclass
class Power:
watt: int
@dataclass
class TeraHashrate:
terahash_per_second: float
@dataclass
class HashboardPerformanceSettings:
id: str
frequency: Frequency
voltage: Voltage
@dataclass
class ManualPerformanceMode:
global_frequency: Frequency
global_voltage: Voltage
hashboards: list[HashboardPerformanceSettings]
@dataclass
class PowerTargetMode:
power_target: Power
@dataclass
class HashrateTargetMode:
hashrate_target: TeraHashrate
@dataclass
class TunerPerformanceMode:
target: Union[PowerTargetMode, HashrateTargetMode]
@dataclass
class PerformanceMode:
mode: Union[ManualPerformanceMode, TunerPerformanceMode]
@classmethod
def create(
cls,
power_target: int = None,
hashrate_target: float = None,
manual_configuration: ManualPerformanceMode = None,
):
provided_args = [power_target, hashrate_target, manual_configuration]
if sum(arg is not None for arg in provided_args) > 1:
raise ValueError(
"More than one keyword argument provided. Please use only power target, hashrate target, or manual config."
)
elif sum(arg is not None for arg in provided_args) < 1:
raise ValueError(
"Please pass one of power target, hashrate target, or manual config."
)
if power_target is not None:
return cls(
mode=TunerPerformanceMode(
target=PowerTargetMode(power_target=Power(watt=power_target))
)
)
elif hashrate_target is not None:
return cls(
mode=TunerPerformanceMode(
target=HashrateTargetMode(
hashrate_target=TeraHashrate(
terahash_per_second=hashrate_target
)
)
)
)
elif manual_configuration is not None:
return cls(mode=manual_configuration)
def as_dict(self):
return asdict(self)

File diff suppressed because one or more lines are too long

View File

@@ -1,75 +0,0 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/pool.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import common_pb2 as bos_dot_v1_dot_common__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x11\x62os/v1/pool.proto\x12\x0e\x62raiins.bos.v1\x1a\x13\x62os/v1/common.proto"\x16\n\x05Quota\x12\r\n\x05value\x18\x01 \x01(\r" \n\x0f\x46ixedShareRatio\x12\r\n\x05value\x18\x01 \x01(\x01"\xe4\x01\n\x16PoolGroupConfiguration\x12\x0b\n\x03uid\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12&\n\x05quota\x18\x03 \x01(\x0b\x32\x15.braiins.bos.v1.QuotaH\x00\x12<\n\x11\x66ixed_share_ratio\x18\x04 \x01(\x0b\x32\x1f.braiins.bos.v1.FixedShareRatioH\x00\x12\x30\n\x05pools\x18\x05 \x03(\x0b\x32!.braiins.bos.v1.PoolConfigurationB\x17\n\x15load_balance_strategy"\x81\x01\n\x11PoolConfiguration\x12\x0b\n\x03uid\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x0c\n\x04user\x18\x03 \x01(\t\x12\x15\n\x08password\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07\x65nabled\x18\x05 \x01(\x08H\x01\x88\x01\x01\x42\x0b\n\t_passwordB\n\n\x08_enabled"\xb0\x01\n\tPoolGroup\x12\x0c\n\x04name\x18\x01 \x01(\t\x12&\n\x05quota\x18\x02 \x01(\x0b\x32\x15.braiins.bos.v1.QuotaH\x00\x12<\n\x11\x66ixed_share_ratio\x18\x03 \x01(\x0b\x32\x1f.braiins.bos.v1.FixedShareRatioH\x00\x12#\n\x05pools\x18\x04 \x03(\x0b\x32\x14.braiins.bos.v1.PoolB\n\n\x08strategy"\x88\x01\n\x04Pool\x12\x0b\n\x03uid\x18\x01 \x01(\t\x12\x0b\n\x03url\x18\x02 \x01(\t\x12\x0c\n\x04user\x18\x03 \x01(\t\x12\x0f\n\x07\x65nabled\x18\x04 \x01(\x08\x12\r\n\x05\x61live\x18\x05 \x01(\x08\x12\x0e\n\x06\x61\x63tive\x18\x06 \x01(\x08\x12(\n\x05stats\x18\x07 \x01(\x0b\x32\x19.braiins.bos.v1.PoolStats"\x98\x01\n\tPoolStats\x12\x17\n\x0f\x61\x63\x63\x65pted_shares\x18\x01 \x01(\x04\x12\x17\n\x0frejected_shares\x18\x02 \x01(\x04\x12\x14\n\x0cstale_shares\x18\x03 \x01(\x04\x12\x17\n\x0flast_difficulty\x18\x04 \x01(\x04\x12\x12\n\nbest_share\x18\x05 \x01(\x04\x12\x16\n\x0egenerated_work\x18\x06 \x01(\x04"\x16\n\x14GetPoolGroupsRequest"G\n\x15GetPoolGroupsResponse\x12.\n\x0bpool_groups\x18\x01 \x03(\x0b\x32\x19.braiins.bos.v1.PoolGroup"\x80\x01\n\x16\x43reatePoolGroupRequest\x12/\n\x0bsave_action\x18\x01 \x01(\x0e\x32\x1a.braiins.bos.v1.SaveAction\x12\x35\n\x05group\x18\x02 \x01(\x0b\x32&.braiins.bos.v1.PoolGroupConfiguration"P\n\x17\x43reatePoolGroupResponse\x12\x35\n\x05group\x18\x01 \x01(\x0b\x32&.braiins.bos.v1.PoolGroupConfiguration"\x80\x01\n\x16UpdatePoolGroupRequest\x12/\n\x0bsave_action\x18\x01 \x01(\x0e\x32\x1a.braiins.bos.v1.SaveAction\x12\x35\n\x05group\x18\x02 \x01(\x0b\x32&.braiins.bos.v1.PoolGroupConfiguration"P\n\x17UpdatePoolGroupResponse\x12\x35\n\x05group\x18\x01 \x01(\x0b\x32&.braiins.bos.v1.PoolGroupConfiguration"V\n\x16RemovePoolGroupRequest\x12/\n\x0bsave_action\x18\x01 \x01(\x0e\x32\x1a.braiins.bos.v1.SaveAction\x12\x0b\n\x03uid\x18\x02 \x01(\t"\x19\n\x17RemovePoolGroupResponse2\x97\x03\n\x0bPoolService\x12\\\n\rGetPoolGroups\x12$.braiins.bos.v1.GetPoolGroupsRequest\x1a%.braiins.bos.v1.GetPoolGroupsResponse\x12\x62\n\x0f\x43reatePoolGroup\x12&.braiins.bos.v1.CreatePoolGroupRequest\x1a\'.braiins.bos.v1.CreatePoolGroupResponse\x12\x62\n\x0fUpdatePoolGroup\x12&.braiins.bos.v1.UpdatePoolGroupRequest\x1a\'.braiins.bos.v1.UpdatePoolGroupResponse\x12\x62\n\x0fRemovePoolGroup\x12&.braiins.bos.v1.RemovePoolGroupRequest\x1a\'.braiins.bos.v1.RemovePoolGroupResponseb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.pool_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_QUOTA"]._serialized_start = 58
_globals["_QUOTA"]._serialized_end = 80
_globals["_FIXEDSHARERATIO"]._serialized_start = 82
_globals["_FIXEDSHARERATIO"]._serialized_end = 114
_globals["_POOLGROUPCONFIGURATION"]._serialized_start = 117
_globals["_POOLGROUPCONFIGURATION"]._serialized_end = 345
_globals["_POOLCONFIGURATION"]._serialized_start = 348
_globals["_POOLCONFIGURATION"]._serialized_end = 477
_globals["_POOLGROUP"]._serialized_start = 480
_globals["_POOLGROUP"]._serialized_end = 656
_globals["_POOL"]._serialized_start = 659
_globals["_POOL"]._serialized_end = 795
_globals["_POOLSTATS"]._serialized_start = 798
_globals["_POOLSTATS"]._serialized_end = 950
_globals["_GETPOOLGROUPSREQUEST"]._serialized_start = 952
_globals["_GETPOOLGROUPSREQUEST"]._serialized_end = 974
_globals["_GETPOOLGROUPSRESPONSE"]._serialized_start = 976
_globals["_GETPOOLGROUPSRESPONSE"]._serialized_end = 1047
_globals["_CREATEPOOLGROUPREQUEST"]._serialized_start = 1050
_globals["_CREATEPOOLGROUPREQUEST"]._serialized_end = 1178
_globals["_CREATEPOOLGROUPRESPONSE"]._serialized_start = 1180
_globals["_CREATEPOOLGROUPRESPONSE"]._serialized_end = 1260
_globals["_UPDATEPOOLGROUPREQUEST"]._serialized_start = 1263
_globals["_UPDATEPOOLGROUPREQUEST"]._serialized_end = 1391
_globals["_UPDATEPOOLGROUPRESPONSE"]._serialized_start = 1393
_globals["_UPDATEPOOLGROUPRESPONSE"]._serialized_end = 1473
_globals["_REMOVEPOOLGROUPREQUEST"]._serialized_start = 1475
_globals["_REMOVEPOOLGROUPREQUEST"]._serialized_end = 1561
_globals["_REMOVEPOOLGROUPRESPONSE"]._serialized_start = 1563
_globals["_REMOVEPOOLGROUPRESPONSE"]._serialized_end = 1588
_globals["_POOLSERVICE"]._serialized_start = 1591
_globals["_POOLSERVICE"]._serialized_end = 1998
# @@protoc_insertion_point(module_scope)

View File

@@ -1,61 +0,0 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/units.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x12\x62os/v1/units.proto\x12\x0e\x62raiins.bos.v1"+\n\x0cMegaHashrate\x12\x1b\n\x13megahash_per_second\x18\x01 \x01(\x01"+\n\x0cGigaHashrate\x12\x1b\n\x13gigahash_per_second\x18\x01 \x01(\x01"+\n\x0cTeraHashrate\x12\x1b\n\x13terahash_per_second\x18\x01 \x01(\x01"\x1a\n\tFrequency\x12\r\n\x05hertz\x18\x01 \x01(\x01"\x17\n\x07Voltage\x12\x0c\n\x04volt\x18\x01 \x01(\x01"\x15\n\x05Power\x12\x0c\n\x04watt\x18\x01 \x01(\x04"-\n\x0fPowerEfficiency\x12\x1a\n\x12joule_per_terahash\x18\x01 \x01(\x01"\x1f\n\x0bTemperature\x12\x10\n\x08\x64\x65gree_c\x18\x01 \x01(\x01"\x1a\n\x0b\x42\x61sesPoints\x12\x0b\n\x03\x62sp\x18\x01 \x01(\r"\x16\n\x05Hours\x12\r\n\x05hours\x18\x01 \x01(\rb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.units_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_MEGAHASHRATE"]._serialized_start = 38
_globals["_MEGAHASHRATE"]._serialized_end = 81
_globals["_GIGAHASHRATE"]._serialized_start = 83
_globals["_GIGAHASHRATE"]._serialized_end = 126
_globals["_TERAHASHRATE"]._serialized_start = 128
_globals["_TERAHASHRATE"]._serialized_end = 171
_globals["_FREQUENCY"]._serialized_start = 173
_globals["_FREQUENCY"]._serialized_end = 199
_globals["_VOLTAGE"]._serialized_start = 201
_globals["_VOLTAGE"]._serialized_end = 224
_globals["_POWER"]._serialized_start = 226
_globals["_POWER"]._serialized_end = 247
_globals["_POWEREFFICIENCY"]._serialized_start = 249
_globals["_POWEREFFICIENCY"]._serialized_end = 294
_globals["_TEMPERATURE"]._serialized_start = 296
_globals["_TEMPERATURE"]._serialized_end = 327
_globals["_BASESPOINTS"]._serialized_start = 329
_globals["_BASESPOINTS"]._serialized_end = 355
_globals["_HOURS"]._serialized_start = 357
_globals["_HOURS"]._serialized_end = 379
# @@protoc_insertion_point(module_scope)

View File

@@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/v1/work.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from ...bos.v1 import units_pb2 as bos_dot_v1_dot_units__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x11\x62os/v1/work.proto\x12\x0e\x62raiins.bos.v1\x1a\x12\x62os/v1/units.proto"\xef\x03\n\x0cRealHashrate\x12-\n\x07last_5s\x18\x01 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12.\n\x08last_15s\x18\x02 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12.\n\x08last_30s\x18\x03 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12-\n\x07last_1m\x18\x04 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12-\n\x07last_5m\x18\x05 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12.\n\x08last_15m\x18\x06 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12.\n\x08last_30m\x18\x07 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12-\n\x07last_1h\x18\x08 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12.\n\x08last_24h\x18\t \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12\x33\n\rsince_restart\x18\n \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate"\xde\x01\n\x0fWorkSolverStats\x12\x33\n\rreal_hashrate\x18\x01 \x01(\x0b\x32\x1c.braiins.bos.v1.RealHashrate\x12\x36\n\x10nominal_hashrate\x18\x02 \x01(\x0b\x32\x1c.braiins.bos.v1.GigaHashrate\x12\x34\n\x0e\x65rror_hashrate\x18\x03 \x01(\x0b\x32\x1c.braiins.bos.v1.MegaHashrate\x12\x14\n\x0c\x66ound_blocks\x18\x04 \x01(\r\x12\x12\n\nbest_share\x18\x05 \x01(\x04\x62\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.v1.work_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_REALHASHRATE"]._serialized_start = 58
_globals["_REALHASHRATE"]._serialized_end = 553
_globals["_WORKSOLVERSTATS"]._serialized_start = 556
_globals["_WORKSOLVERSTATS"]._serialized_end = 778
# @@protoc_insertion_point(module_scope)

View File

@@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2022 Upstream Data Inc -
# -
# Licensed under the Apache License, Version 2.0 (the "License"); -
# you may not use this file except in compliance with the License. -
# You may obtain a copy of the License at -
# -
# http://www.apache.org/licenses/LICENSE-2.0 -
# -
# Unless required by applicable law or agreed to in writing, software -
# distributed under the License is distributed on an "AS IS" BASIS, -
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -
# See the License for the specific language governing permissions and -
# limitations under the License. -
# ------------------------------------------------------------------------------
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bos/version.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n\x11\x62os/version.proto\x12\x0b\x62raiins.bos"U\n\nApiVersion\x12\r\n\x05major\x18\x01 \x01(\x04\x12\r\n\x05minor\x18\x02 \x01(\x04\x12\r\n\x05patch\x18\x03 \x01(\x04\x12\x0b\n\x03pre\x18\x04 \x01(\t\x12\r\n\x05\x62uild\x18\x05 \x01(\t"\x13\n\x11\x41piVersionRequest2]\n\x11\x41piVersionService\x12H\n\rGetApiVersion\x12\x1e.braiins.bos.ApiVersionRequest\x1a\x17.braiins.bos.ApiVersionb\x06proto3'
)
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "bos.version_pb2", _globals)
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_globals["_APIVERSION"]._serialized_start = 34
_globals["_APIVERSION"]._serialized_end = 119
_globals["_APIVERSIONREQUEST"]._serialized_start = 121
_globals["_APIVERSIONREQUEST"]._serialized_end = 140
_globals["_APIVERSIONSERVICE"]._serialized_start = 142
_globals["_APIVERSIONSERVICE"]._serialized_end = 235
# @@protoc_insertion_point(module_scope)

View File

@@ -0,0 +1,80 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: bos/version.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
Dict,
Optional,
)
import betterproto
import grpclib
from betterproto.grpc.grpclib_server import ServiceBase
if TYPE_CHECKING:
import grpclib.server
from betterproto.grpc.grpclib_client import MetadataLike
from grpclib.metadata import Deadline
@dataclass(eq=False, repr=False)
class ApiVersion(betterproto.Message):
"""LATEST_API_VERSION=1.0.0-beta.4"""
major: int = betterproto.uint64_field(1)
minor: int = betterproto.uint64_field(2)
patch: int = betterproto.uint64_field(3)
pre: str = betterproto.string_field(4)
build: str = betterproto.string_field(5)
@dataclass(eq=False, repr=False)
class ApiVersionRequest(betterproto.Message):
pass
class ApiVersionServiceStub(betterproto.ServiceStub):
async def get_api_version(
self,
api_version_request: "ApiVersionRequest",
*,
timeout: Optional[float] = None,
deadline: Optional["Deadline"] = None,
metadata: Optional["MetadataLike"] = None
) -> "ApiVersion":
return await self._unary_unary(
"/braiins.bos.ApiVersionService/GetApiVersion",
api_version_request,
ApiVersion,
timeout=timeout,
deadline=deadline,
metadata=metadata,
)
class ApiVersionServiceBase(ServiceBase):
async def get_api_version(
self, api_version_request: "ApiVersionRequest"
) -> "ApiVersion":
raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
async def __rpc_get_api_version(
self, stream: "grpclib.server.Stream[ApiVersionRequest, ApiVersion]"
) -> None:
request = await stream.recv_message()
response = await self.get_api_version(request)
await stream.send_message(response)
def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
return {
"/braiins.bos.ApiVersionService/GetApiVersion": grpclib.const.Handler(
self.__rpc_get_api_version,
grpclib.const.Cardinality.UNARY_UNARY,
ApiVersionRequest,
ApiVersion,
),
}

File diff suppressed because it is too large Load Diff