From 1afef7658422153638cd4979358a97b5803e23a4 Mon Sep 17 00:00:00 2001 From: imac Date: Wed, 7 May 2025 08:05:54 -0700 Subject: [PATCH 1/2] Add: repo auto update feature to validator --- .DS_Store | Bin 0 -> 6148 bytes __init__.py | 7 +++++++ validator/validator_daemon.py | 35 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .DS_Store create mode 100644 __init__.py diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dfe4059258fd39c054d093f941a110d3e7973f41 GIT binary patch literal 6148 zcmeHKu}%U(5S@j?pf;FT*m>~-H2lFyu-1eRQ1J|qfJXo=&GohxTKEq}6FXyPZRH=B z*cyzszS&)27miY6%uKTL_I74==H7C7aa<-U5m6D1F<5}g5VmuhlAIk`1}dJT z-6+=%l1_KZQwD?qVc;(^z~62_>(rnY4ZQC+x4q-qI!U!!Zzpw(6Y3*|R;o{FHM3IqFlB z_Nj*oV!wj5vq`&K!+r4nU4u7=Tg5CNzYe`s7HEJ9`p|v9ii`7Kk#TKohF$6+@YD zjEB}QvX~k);iT;4L)pyA-cXdzj`>6FPAW1eS{M)pd)*U{ISJ1S;7IFs|SxgOL1R{R~G!3GJ IfnR0d3uj8SH2?qr literal 0 HcmV?d00001 diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..adfbec4 --- /dev/null +++ b/__init__.py @@ -0,0 +1,7 @@ +__version__ = "0.0.8" +version_split = __version__.split(".") +__spec_version__ = ( + (1000 * int(version_split[0])) + + (10 * int(version_split[1])) + + (1 * int(version_split[2])) +) \ No newline at end of file diff --git a/validator/validator_daemon.py b/validator/validator_daemon.py index d7f2259..b60f1f8 100644 --- a/validator/validator_daemon.py +++ b/validator/validator_daemon.py @@ -6,6 +6,9 @@ import numpy as np import bittensor as bt import logging +import re +import subprocess +import codecs from typing import List from shared.debug_util import DEBUG_LOCAL from shared.log_data import LoggerType @@ -128,6 +131,33 @@ def aggregate_results(results_dir, moving_scores): bt.logging.error(f"DAEMON | Error deleting file {filepath}: {e}") return moving_scores, vericore_responses +def update_repository(): + bt.logging.info("checking repository updates") + try: + subprocess.run(["git", "pull"], check=True) + except subprocess.CalledProcessError: + bt.logging.error("Git pull failed") + return False + + here = os.path.abspath(os.path.dirname(__file__)) + parent_dir = os.path.dirname(here) + init_file_path = os.path.join(parent_dir, '__init__.py') + + with codecs.open(init_file_path, encoding='utf-8') as init_file: + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", init_file.read(), re.M) + if version_match: + new_version = version_match.group(1) + current_version = __version__ + bt.logging.success(f"current version: {current_version}, new version: {new_version}") + if current_version != new_version: + try: + # subprocess.run(["python3", "voiceguard/utils/download.py"], check=True) + subprocess.run(["python3", "-m", "pip", "install", "-e", "."], check=True) + os._exit(1) + except subprocess.CalledProcessError: + bt.logging.error("Pip install failed") + else: + bt.logging.info("No changes detected!") def main(): config = get_config() @@ -200,6 +230,11 @@ def main(): incentives, ) + if step % 5 == 0: + update_repository() + + step += 1 + metagraph.sync() time.sleep(60) except KeyboardInterrupt: From 8019d2246dfeffd8353e226ba39199c41aa51613 Mon Sep 17 00:00:00 2001 From: panthervis Date: Wed, 7 May 2025 08:06:29 -0700 Subject: [PATCH 2/2] Add: repo auto update feature to validator --- .DS_Store | Bin 6148 -> 6148 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/.DS_Store b/.DS_Store index dfe4059258fd39c054d093f941a110d3e7973f41..397a6f2c2cee00240350fb691179494e827c5225 100644 GIT binary patch delta 106 zcmZoMXffEJ#uA(C$iTqB!l1{H&XCDalAG`1l9ZF51Qg@=Z)v4_{pm3@`4qUk!+u3g Yboqh|!{Frn+ybC}ps5O*n^_u#0mbhdM*si- delta 106 zcmZoMXffEJ#uDovz`(%3!l1{H&XCDalAG`1l9ZF51Qg@Qe37#M+S6l>sPZXr`OkGz bHlxcIWEch~=jRpx^)N6nZ`j<-(kKi7H#!~@