From 5e35570d3c13f9ba4a30c31becc9f89fab2c7bcb Mon Sep 17 00:00:00 2001 From: clore Date: Tue, 3 Sep 2024 23:17:46 +0000 Subject: [PATCH] DONT_USE_HIVE_BINARIES, AUTH_TOKEN env parameters --- clore_hosting/main.py | 9 ++++++--- lib/nvml.py | 4 ++-- lib/utils.py | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/clore_hosting/main.py b/clore_hosting/main.py index 19051b9..7359ff4 100644 --- a/clore_hosting/main.py +++ b/clore_hosting/main.py @@ -116,7 +116,10 @@ class CloreClient: self.restart_docker = True # Restart docker when it's loaded under systemd (accual restart will happen only if no orders running to not disrupt workload) docker_interface.verify_docker_version() - nvml.init() + + self.dont_use_hive_binaries = True if 'DONT_USE_HIVE_BINARIES' in os.environ else False + + nvml.init(allow_hive_binaries=not self.dont_use_hive_binaries) self.gpu_oc_specs = nvml.get_gpu_oc_specs() self.last_oc_service_submit = 0 @@ -492,10 +495,10 @@ class CloreClient: await monitoring.put("oc_service") oc_apply_allowed = True ### OC Service should also hande Hive stuff - if self.use_hive_flightsheet and self.is_hive: + if self.use_hive_flightsheet and self.is_hive and not self.dont_use_hive_binaries: await set_hive_miner_status(True) oc_apply_allowed = False # Don't apply any OC when running HiveOS miner - elif self.is_hive: + elif self.is_hive and not self.dont_use_hive_binaries: await set_hive_miner_status(False) ### Run OC tasks oc_conf = WebSocketClient.get_oc() diff --git a/lib/nvml.py b/lib/nvml.py index f35bda4..8b0a567 100644 --- a/lib/nvml.py +++ b/lib/nvml.py @@ -70,13 +70,13 @@ is_hive = False all_gpus_data_list=[] get_data_fail=False -def init(gpu_specs_file=None): +def init(gpu_specs_file=None, allow_hive_binaries=True): global is_hive, all_gpus_data_list, get_data_fail log.info("Loading GPU OC specs [ working ]") try: pynvml.nvmlInit() kernel = get_specs.get_kernel() - if "hive" in kernel: + if "hive" in kernel and allow_hive_binaries: is_hive=True specs_file_loc = gpu_specs_file if gpu_specs_file else config.gpu_specs_file diff --git a/lib/utils.py b/lib/utils.py index accb84a..c6b9aa4 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -41,6 +41,8 @@ def normalize_rule(rule_dict): def get_auth(): try: + if 'AUTH_TOKEN' in os.environ: + return os.environ['AUTH_TOKEN'] auth_str = '' with open(config.auth_file, "r", encoding="utf-8") as file: auth_str = file.read().strip()