Skip to content

Commit

Permalink
explicitly pass argparse from validator to config
Browse files Browse the repository at this point in the history
  • Loading branch information
hscott-yuma committed Dec 19, 2024
1 parent 16a07be commit 5286cb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions precog/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import argparse
import os
import subprocess
from typing import Optional

import bittensor as bt

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion precog/validators/validator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import argparse
import asyncio
from pathlib import Path

Expand All @@ -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"
Expand Down

0 comments on commit 5286cb9

Please sign in to comment.