Merge branch 'main' of https://git.clore.ai/clore/onboarding
This commit is contained in:
commit
bf2d3e4fd8
|
@ -89,7 +89,7 @@ def validate_clore_config(clore_config):
|
||||||
1 <= value["on_demand_multiplier"] <= 50 and 1 <= value["spot_multiplier"] <= 50
|
1 <= value["on_demand_multiplier"] <= 50 and 1 <= value["spot_multiplier"] <= 50
|
||||||
|
|
||||||
def is_valid_mrl(value):
|
def is_valid_mrl(value):
|
||||||
return isinstance(value, int) and 6 <= value <= 1440
|
return isinstance(value, int) and 6 <= value <= 3000
|
||||||
|
|
||||||
def is_valid_keep_params(value):
|
def is_valid_keep_params(value):
|
||||||
return isinstance(value, bool)
|
return isinstance(value, bool)
|
||||||
|
@ -98,9 +98,9 @@ def validate_clore_config(clore_config):
|
||||||
required_keys = {"on_demand_bitcoin", "on_demand_clore", "spot_bitcoin", "spot_clore"}
|
required_keys = {"on_demand_bitcoin", "on_demand_clore", "spot_bitcoin", "spot_clore"}
|
||||||
if required_keys.issubset(clore_config):
|
if required_keys.issubset(clore_config):
|
||||||
return 0.000001 <= clore_config["on_demand_bitcoin"] <= 0.005 and \
|
return 0.000001 <= clore_config["on_demand_bitcoin"] <= 0.005 and \
|
||||||
0.1 <= clore_config["on_demand_clore"] <= 5000 and \
|
0.1 <= clore_config["on_demand_clore"] <= 10000 and \
|
||||||
0.000001 <= clore_config["spot_bitcoin"] <= 0.005 and \
|
0.000001 <= clore_config["spot_bitcoin"] <= 0.005 and \
|
||||||
0.1 <= clore_config["spot_clore"] <= 5000
|
0.1 <= clore_config["spot_clore"] <= 10000
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_valid_usd_pricing(autoprice):
|
def is_valid_usd_pricing(autoprice):
|
||||||
|
@ -126,7 +126,7 @@ def validate_clore_config(clore_config):
|
||||||
errors.append("multipliers are not following spec")
|
errors.append("multipliers are not following spec")
|
||||||
|
|
||||||
if "mrl" not in clore_config or not is_valid_mrl(clore_config["mrl"]):
|
if "mrl" not in clore_config or not is_valid_mrl(clore_config["mrl"]):
|
||||||
errors.append("mrl is mandatory and must be an integer in range 6-1440")
|
errors.append("mrl is mandatory and must be an integer in range 6-3000")
|
||||||
|
|
||||||
if "keep_params" in clore_config and not is_valid_keep_params(clore_config["keep_params"]):
|
if "keep_params" in clore_config and not is_valid_keep_params(clore_config["keep_params"]):
|
||||||
errors.append("keep_params must be a boolean value")
|
errors.append("keep_params must be a boolean value")
|
||||||
|
@ -257,6 +257,20 @@ async def hive_load_configs(default_power_limits, static_config):
|
||||||
clore_config = possible_clore_config
|
clore_config = possible_clore_config
|
||||||
elif key == "CUSTOM_MINER" and value == "clore":
|
elif key == "CUSTOM_MINER" and value == "clore":
|
||||||
clore_miner_present = True
|
clore_miner_present = True
|
||||||
|
elif key == "CLORE_RENTALS_TOKEN":
|
||||||
|
possible_clore_config = base64_string_to_json(value)
|
||||||
|
if possible_clore_config:
|
||||||
|
clore_config = possible_clore_config
|
||||||
|
elif key == "META":
|
||||||
|
try:
|
||||||
|
meta_value = json.loads(value)
|
||||||
|
if (isinstance(meta_value, dict) and
|
||||||
|
"clore-rentals" in meta_value and
|
||||||
|
isinstance(meta_value["clore-rentals"], dict) and
|
||||||
|
meta_value["clore-rentals"].get("coin") == "CLORE-Rentals"):
|
||||||
|
clore_miner_present = True
|
||||||
|
except (json.JSONDecodeError, TypeError, KeyError) as e:
|
||||||
|
pass
|
||||||
|
|
||||||
if (not clore_miner_present or not clore_config) and parsed_static_config:
|
if (not clore_miner_present or not clore_config) and parsed_static_config:
|
||||||
clore_miner_present = True
|
clore_miner_present = True
|
||||||
|
@ -490,7 +504,7 @@ async def main(machine_specs):
|
||||||
await asyncio.sleep(60 if ever_pending_creation else 10)
|
await asyncio.sleep(60 if ever_pending_creation else 10)
|
||||||
ever_pending_creation = True
|
ever_pending_creation = True
|
||||||
last_used_config = None
|
last_used_config = None
|
||||||
elif "init_communication_token" in response_data and "private_communication_token":
|
elif "init_communication_token" in response_data and "private_communication_token" in response_data:
|
||||||
clore_hosting_sw_auth_str = f"{response_data['init_communication_token']}:{response_data['private_communication_token']}"
|
clore_hosting_sw_auth_str = f"{response_data['init_communication_token']}:{response_data['private_communication_token']}"
|
||||||
was_ok = verify_or_update_file(args.auth_file, clore_hosting_sw_auth_str)
|
was_ok = verify_or_update_file(args.auth_file, clore_hosting_sw_auth_str)
|
||||||
if was_ok:
|
if was_ok:
|
||||||
|
|
Loading…
Reference in New Issue