Skip to content

Commit

Permalink
fix: removed env for worker-api in validator side
Browse files Browse the repository at this point in the history
  • Loading branch information
codebender37 committed Oct 10, 2024
1 parent ac7ec00 commit f5aecce
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion .env.validator.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
DOJO_API_BASE_URL=
WANDB_API_KEY=

# for dojo-synthetic-api
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,10 +386,7 @@ Copy the validator .env file and set up the .env file
cp .env.validator.example .env

# edit the .env file with vim, vi or nano
# for mainnet
DOJO_API_BASE_URL="https://dojo-api.tensorplex.ai"
# for testnet
DOJO_API_BASE_URL="https://dojo-api-testnet.tensorplex.ai"

# head to https://wandb.ai/authorize to get your API key
WANDB_API_KEY="<wandb_key>"

Expand Down
3 changes: 2 additions & 1 deletion commons/human_feedback/dojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

import template
from commons.utils import loaddotenv, set_expire_time
from template import DOJO_API_BASE_URL
from template import get_dojo_api_base_url
from template.protocol import FeedbackRequest, MultiScoreCriteria, RankingCriteria

DOJO_API_BASE_URL = get_dojo_api_base_url()
# Set to True to enable debug mode
# TODO could possible setup with logger to enable debug mode
DEBUG = False
Expand Down
4 changes: 3 additions & 1 deletion dojo_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from prompt_toolkit.completion import FuzzyCompleter, WordCompleter
from rich.console import Console

from template import DOJO_API_BASE_URL
from template import get_dojo_api_base_url

DOJO_API_BASE_URL = get_dojo_api_base_url()

load_dotenv()
console = Console()
Expand Down
2 changes: 0 additions & 2 deletions main_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from commons.api.middleware import LimitContentLengthMiddleware
from commons.api.reward_route import reward_router
from commons.dataset.synthetic import SyntheticAPI
from commons.human_feedback.dojo import DojoAPI
from commons.objects import ObjectManager
from database.client import connect_db, disconnect_db
from neurons.validator import DojoTaskTracker
Expand All @@ -32,7 +31,6 @@ async def lifespan(app: FastAPI):
wandb.finish()
validator.save_state()
await SyntheticAPI._session.close()
await DojoAPI._http_client.aclose()
await disconnect_db()


Expand Down
10 changes: 7 additions & 3 deletions template/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def get_latest_git_tag():
MINER_STATUS = 60
DOJO_TASK_MONITORING = 60

DOJO_API_BASE_URL = os.getenv("DOJO_API_BASE_URL")
if DOJO_API_BASE_URL is None:
raise ValueError("DOJO_API_BASE_URL is not set in the environment")

def get_dojo_api_base_url() -> str:
base_url = os.getenv("DOJO_API_BASE_URL")
if base_url is None:
raise ValueError("DOJO_API_BASE_URL is not set in the environment.")

return base_url

0 comments on commit f5aecce

Please sign in to comment.