added bos config -> general standard config

This commit is contained in:
UpstreamData
2021-10-26 16:42:46 -06:00
parent 1372183af8
commit be213c202f
4 changed files with 190 additions and 36 deletions

View File

@@ -64,46 +64,11 @@ class BOSminer(BaseMiner):
toml_data = toml.loads(await file.read())
self.config = toml_data
def update_config(self, config: dict) -> None:
self.config = config
async def get_hostname(self) -> str:
async with (await self._get_ssh_connection()) as conn:
data = await conn.run('cat /proc/sys/kernel/hostname')
return data.stdout.strip()
async def change_config_format(self, update_config: bool = False) -> dict:
if not self.config:
await self.get_config()
config = self.config
config['format']['generator'] = 'upstream_data_configurator'
config['format']['timestamp'] = int(time.time())
if update_config:
self.update_config(config)
return config
async def change_config_tuning(self, wattage: int, enabled: bool = True, update_config: bool = False) -> dict:
if not self.config:
await self.get_config()
config = self.config
config['autotuning']['psu_power_limit'] = wattage
config['autotuning']['enabled'] = enabled
if update_config:
self.update_config(config)
return config
async def change_config_temp_ctrl(self, target: float = 80.0, hot: float = 100.0,
dangerous: float = 110.0, update_config: bool = False) -> dict:
if not self.config:
await self.get_config()
config = self.config
config['target_temp'] = target
config['hot_temp'] = hot
config['dangerous_temp'] = dangerous
if update_config:
self.update_config(config)
return config
async def send_config(self, config: dict) -> None:
toml_conf = toml.dumps(config)
async with (await self._get_ssh_connection()) as conn: