added changing model when configuring for BOS S9s
This commit is contained in:
@@ -185,4 +185,4 @@ async def general_config_convert_bos(yaml_config):
|
|||||||
out_config["power_scaling"]["shutdown_duration"] = config[opt]["shutdown_duration"]
|
out_config["power_scaling"]["shutdown_duration"] = config[opt]["shutdown_duration"]
|
||||||
else:
|
else:
|
||||||
out_config["power_scaling"]["shutdown_duration"] = 3.0
|
out_config["power_scaling"]["shutdown_duration"] = 3.0
|
||||||
return toml.dumps(out_config)
|
return out_config
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
|
import logging
|
||||||
|
import toml
|
||||||
|
|
||||||
from miners.bosminer import BOSMiner
|
from miners.bosminer import BOSMiner
|
||||||
|
from config.bos import general_config_convert_bos
|
||||||
|
|
||||||
|
|
||||||
class BOSMinerS9(BOSMiner):
|
class BOSMinerS9(BOSMiner):
|
||||||
@@ -9,3 +13,18 @@ class BOSMinerS9(BOSMiner):
|
|||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f"BOSminerS9: {str(self.ip)}"
|
return f"BOSminerS9: {str(self.ip)}"
|
||||||
|
|
||||||
|
async def send_config(self, yaml_config) -> None:
|
||||||
|
"""Configures miner with yaml config."""
|
||||||
|
logging.debug(f"{self}: Sending config.")
|
||||||
|
conf = await general_config_convert_bos(yaml_config)
|
||||||
|
toml_conf = toml.dumps(conf)
|
||||||
|
conf["format"]["model"] = "Antminer S9"
|
||||||
|
async with (await self._get_ssh_connection()) as conn:
|
||||||
|
logging.debug(f"{self}: Opening SFTP connection.")
|
||||||
|
async with conn.start_sftp_client() as sftp:
|
||||||
|
logging.debug(f"{self}: Opening config file.")
|
||||||
|
async with sftp.open('/etc/bosminer.toml', 'w+') as file:
|
||||||
|
await file.write(toml_conf)
|
||||||
|
logging.debug(f"{self}: Restarting BOSMiner")
|
||||||
|
await conn.run("/etc/init.d/bosminer restart")
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class BOSMiner(BaseMiner):
|
|||||||
async def send_config(self, yaml_config) -> None:
|
async def send_config(self, yaml_config) -> None:
|
||||||
"""Configures miner with yaml config."""
|
"""Configures miner with yaml config."""
|
||||||
logging.debug(f"{self}: Sending config.")
|
logging.debug(f"{self}: Sending config.")
|
||||||
toml_conf = await general_config_convert_bos(yaml_config)
|
toml_conf = toml.dumps(await general_config_convert_bos(yaml_config))
|
||||||
async with (await self._get_ssh_connection()) as conn:
|
async with (await self._get_ssh_connection()) as conn:
|
||||||
logging.debug(f"{self}: Opening SFTP connection.")
|
logging.debug(f"{self}: Opening SFTP connection.")
|
||||||
async with conn.start_sftp_client() as sftp:
|
async with conn.start_sftp_client() as sftp:
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ async def import_config_file(file_location):
|
|||||||
|
|
||||||
async def export_config_file(file_location, config):
|
async def export_config_file(file_location, config):
|
||||||
await update_ui_with_data("status", "Exporting")
|
await update_ui_with_data("status", "Exporting")
|
||||||
config = await general_config_convert_bos(config)
|
config = toml.dumps(await general_config_convert_bos(config))
|
||||||
config = toml.loads(config)
|
config = toml.loads(config)
|
||||||
config['format']['generator'] = 'upstream_config_util'
|
config['format']['generator'] = 'upstream_config_util'
|
||||||
config['format']['timestamp'] = int(time.time())
|
config['format']['timestamp'] = int(time.time())
|
||||||
|
|||||||
@@ -16,12 +16,13 @@ from settings import CFG_UTIL_CONFIG_THREADS as CONFIG_THREADS, CFG_UTIL_REBOOT_
|
|||||||
|
|
||||||
async def import_config(idx):
|
async def import_config(idx):
|
||||||
await update_ui_with_data("status", "Importing")
|
await update_ui_with_data("status", "Importing")
|
||||||
logging.debug(f"{window['ip_table'].Values[idx[0]][0]}: Importing config.")
|
miner_ip = window['ip_table'].Values[idx[0]][0]
|
||||||
miner = await MinerFactory().get_miner(ipaddress.ip_address(window["ip_table"].Values[idx[0]][0]))
|
logging.debug(f"{miner_ip}: Importing config.")
|
||||||
|
miner = await MinerFactory().get_miner(ipaddress.ip_address(miner_ip))
|
||||||
await miner.get_config()
|
await miner.get_config()
|
||||||
config = miner.config
|
config = miner.config
|
||||||
await update_ui_with_data("config", str(config))
|
await update_ui_with_data("config", str(config))
|
||||||
logging.debug(f"{window['ip_table'].Values[idx[0]][0]}: Config import completed.")
|
logging.debug(f"{miner_ip}: Config import completed.")
|
||||||
await update_ui_with_data("status", "")
|
await update_ui_with_data("status", "")
|
||||||
|
|
||||||
|
|
||||||
@@ -462,23 +463,24 @@ async def generate_config(username, workername, v2_allowed):
|
|||||||
url_2 = 'stratum+tcp://us-east.stratum.slushpool.com:3333'
|
url_2 = 'stratum+tcp://us-east.stratum.slushpool.com:3333'
|
||||||
url_3 = 'stratum+tcp://stratum.slushpool.com:3333'
|
url_3 = 'stratum+tcp://stratum.slushpool.com:3333'
|
||||||
|
|
||||||
config = {'group': [{
|
config = {
|
||||||
'name': 'group',
|
'group': [{
|
||||||
'quota': 1,
|
'name': 'group',
|
||||||
'pool': [{
|
'quota': 1,
|
||||||
'url': url_1,
|
'pool': [{
|
||||||
'user': user,
|
'url': url_1,
|
||||||
'password': '123'
|
'user': user,
|
||||||
}, {
|
'password': '123'
|
||||||
'url': url_2,
|
}, {
|
||||||
'user': user,
|
'url': url_2,
|
||||||
'password': '123'
|
'user': user,
|
||||||
}, {
|
'password': '123'
|
||||||
'url': url_3,
|
}, {
|
||||||
'user': user,
|
'url': url_3,
|
||||||
'password': '123'
|
'user': user,
|
||||||
}]
|
'password': '123'
|
||||||
}],
|
}]
|
||||||
|
}],
|
||||||
'format': {
|
'format': {
|
||||||
'version': '1.2+',
|
'version': '1.2+',
|
||||||
'model': 'Antminer S9',
|
'model': 'Antminer S9',
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
if (!window.WebSocket) alert("WebSocket not supported by this browser");
|
if (!window.WebSocket) alert("WebSocket not supported by this browser");
|
||||||
var ws = new WebSocket("ws://{{request.url.hostname}}:80/dashboard/ws");
|
var ws = new WebSocket("ws://{{request.url.hostname}}:10000/dashboard/ws");
|
||||||
let all_data = []
|
let all_data = []
|
||||||
let all_labels = []
|
let all_labels = []
|
||||||
ws.onmessage = function(event) {
|
ws.onmessage = function(event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user