From cc617b9c2fa18d013b38a1b36487e79594a919ea Mon Sep 17 00:00:00 2001 From: Scott Alfter Date: Wed, 24 Jan 2018 10:12:24 -0800 Subject: [PATCH] selectable estimate...want to try estimate_last24h to see if it doesn't switch as often --- README.md | 27 +++++++++++++++++++++++++++ zpool-switch.py | 16 ++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 35b6730..416ca44 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,33 @@ configuration between the different pools. I started this under nvOC, but have since migrated my mining rig from nvOC to a standard Gentoo Linux setup. +Usage +===== + +./zpool-switch.py conf-file miner-file algo-map estimate_selection [algo] + +The switcher takes four parameters in normal operation: + +conf-file: general configuration (JSON) + +miner-file: miner configuration (JSON) + +algo-map: mapping from the algorithm labels zpool uses to the ones used in +miner-file (JSON) + +estimate_selection: one of three values to determine switching behavior, +based on the three estimates provided by zpool: estimate_current, +estimate_last24h, actual_last24h. estimate_current is likely to lead to +more frequent switching than the other two. + +The optional fifth parameter lets you manually pick an algorithm for mining; +this is useful for testing and benchmarking. + +zpool-switch configures the cards' fan and power settings, starts the miner +in a screen session, and exits. It should be called periodically (perhaps +every 10-15 minutes); you could do this with a shell script, a cron job, or +whatever other method you prefer. + miners.json =========== diff --git a/zpool-switch.py b/zpool-switch.py index 6bcb5b5..9cb73bf 100755 --- a/zpool-switch.py +++ b/zpool-switch.py @@ -70,18 +70,18 @@ miners=filtered_miners # adjust estimates so they're all in the same units: BTC/day per GH/s for i in data: - data[i]["estimate_current"]=float(data[i]["estimate_current"])*1000 + data[i]["estimate"]=float(data[i][sys.argv[4]])*1000 try: - data["sha256"]["estimate_current"]/=1000000000 + data["sha256"]["estimate"]/=1000000000 except: pass try: - data["equihash"]["estimate_current"]*=1000 + data["equihash"]["estimate"]*=1000 except: pass for i in ["scrypt", "blakecoin", "blake2s", "decred", "x11", "quark", "qubit", "keccak"]: try: - data[i]["estimate_current"]/=1000 + data[i]["estimate"]/=1000 except: pass @@ -95,7 +95,7 @@ for i in data: coins[i]["algo"]=i coins[i]["mapped_algo"]=algo_map[i] coins[i]["name"]=i - coins[i]["estimate"]=data[i]["estimate_current"]*float(coins[i]["speed"])-24.0*coins[i]["power"]*pwrcost/exchrate + coins[i]["estimate"]=data[i]["estimate"]*float(coins[i]["speed"])-24.0*coins[i]["power"]*pwrcost/exchrate # sort by profitability @@ -111,7 +111,7 @@ log.close() miner=coins[sort[0][0]] -if (len(sys.argv)==4): +if (len(sys.argv)==5): # exit if maximum is below minimum if (miner["estimate"]