better hiveos miner integration support
This commit is contained in:
parent
81e2659024
commit
d6f90ab497
|
@ -69,7 +69,7 @@ async def get_session_start_time(pid):
|
|||
return None
|
||||
|
||||
async def get_miner_stats(miner_dir, api_timeout=15):
|
||||
stdout, stderr, code = await async_run_bash_command(f'export PATH=$PATH:/hive/sbin:/hive/bin && export API_TIMEOUT={api_timeout}'+''' && read -t $((API_TIMEOUT + 5)) -d "" pid khs stats < <(function run_miner_scripts { echo "$BASHPID"; cd '''+miner_dir+''' || exit; cd '''+miner_dir+'''; source h-manifest.conf; cd '''+miner_dir+'''; source h-config.sh; cd '''+miner_dir+'''; source h-stats.sh; printf "%q\n" "$khs"; echo "$stats"; }; run_miner_scripts) && [[ $? -ge 128 ]] && [[ ! -z "$pid" && "$pid" -ne $$ ]] && kill -9 "$pid" 2>/dev/null ; echo $stats''')
|
||||
stdout, stderr, code = await async_run_bash_command(f'export PATH=$PATH:/hive/sbin:/hive/bin && export API_TIMEOUT={api_timeout}'+''' && read -t $((API_TIMEOUT + 5)) -d "" pid khs stats < <(function run_miner_scripts { echo "$BASHPID"; cd '''+miner_dir+''' || exit; cd '''+miner_dir+'''; source h-manifest.conf; cd '''+miner_dir+'''; source h-stats.sh; printf "%q\n" "$khs"; echo "$stats"; }; run_miner_scripts) && [[ $? -ge 128 ]] && [[ ! -z "$pid" && "$pid" -ne $$ ]] && kill -9 "$pid" 2>/dev/null ; echo $stats''')
|
||||
try:
|
||||
if stdout and not stderr and code == 0:
|
||||
stats = json.loads(stdout)
|
||||
|
|
|
@ -120,7 +120,7 @@ def hive_set_miner_status(enabled=False):
|
|||
elif miner_screen_running and not enabled:
|
||||
run_command(f"/bin/bash -c \"PATH={HIVE_PATH} && sudo /hive/bin/miner stop\"")
|
||||
elif enabled and not miner_screen_running:
|
||||
run_command(f"/bin/bash -c \"PATH={HIVE_PATH} && sudo /hive/sbin/nvidia-oc && sudo /hive/bin/miner start\"")
|
||||
run_command(f"/bin/bash -c \"export PATH={HIVE_PATH} && sudo /hive/sbin/nvidia-oc && source ~/.bashrc ; sudo /hive/bin/miner start\"")
|
||||
|
||||
def get_extra_allowed_images():
|
||||
if os.path.exists(config.extra_allowed_images_file):
|
||||
|
|
Loading…
Reference in New Issue