From 5286cb92d0ec3d5e39c57ece2e63c458f255c40b Mon Sep 17 00:00:00 2001 From: hscott Date: Thu, 19 Dec 2024 15:46:53 -0500 Subject: [PATCH] explicitly pass argparse from validator to config --- precog/utils/config.py | 4 ++-- precog/validators/validator.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/precog/utils/config.py b/precog/utils/config.py index 2b7cb79..91984bb 100644 --- a/precog/utils/config.py +++ b/precog/utils/config.py @@ -19,6 +19,7 @@ import argparse import os import subprocess +from typing import Optional import bittensor as bt @@ -275,11 +276,10 @@ def to_string(bt_config: bt.Config): return string.strip() -def config(neuron_type: str = "validator"): +def config(parser: Optional[argparse.ArgumentParser] = argparse.ArgumentParser(), neuron_type: str = "validator"): """ Returns the configuration object specific to this miner or validator after adding relevant arguments. """ - parser = argparse.ArgumentParser() bt.wallet.add_args(parser) bt.subtensor.add_args(parser) bt.logging.add_args(parser) diff --git a/precog/validators/validator.py b/precog/validators/validator.py index a9b6680..d20bd4f 100755 --- a/precog/validators/validator.py +++ b/precog/validators/validator.py @@ -1,3 +1,4 @@ +import argparse import asyncio from pathlib import Path @@ -7,7 +8,7 @@ class Validator: def __init__(self): - self.config = config(neuron_type="validator") + self.config = config(parser=argparse.ArgumentParser(), neuron_type="validator") print(self.config) full_path = Path( f"{self.config.logging.logging_dir}/{self.config.wallet.name}/{self.config.wallet.hotkey}/netuid{self.config.netuid}/validator"