Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -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]))
)
35 changes: 35 additions & 0 deletions validator/validator_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -200,6 +230,11 @@ def main():
incentives,
)

if step % 5 == 0:
update_repository()

step += 1

metagraph.sync()
time.sleep(60)
except KeyboardInterrupt:
Expand Down