|
30 | 30 | from .router import start_ping_server |
31 | 31 | from ._base import BaseScoringApi |
32 | 32 |
|
33 | | - |
34 | 33 | SCORING_API_PORT = int(os.getenv(f"{ENV_PREFIX_SCORING_API}PORT", 8000)) |
35 | 34 |
|
36 | 35 |
|
@@ -153,7 +152,8 @@ def _fetch_miners_docker_info_from_storage(self) -> dict[str, dict]: |
153 | 152 | "[FETCH MINER DOCKER INFO] Fetching miner docker info from storage" |
154 | 153 | ) |
155 | 154 |
|
156 | | - endpoint = f"{self.config.STORAGE_API_URL}/miner/docker-info" |
| 155 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 156 | + endpoint = f"{storage_url}/miner/docker-info" |
157 | 157 | header = self.validator_request_header_fn({}) |
158 | 158 |
|
159 | 159 | try: |
@@ -377,7 +377,8 @@ def _get_storage_api_key(self) -> str: |
377 | 377 | """ |
378 | 378 | Retrieves the storage API key from the config. |
379 | 379 | """ |
380 | | - endpoint = f"{self.config.STORAGE_API_URL}/get-api-key" |
| 380 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 381 | + endpoint = f"{storage_url}/get-api-key" |
381 | 382 | data = {"validator_uid": self.uid, "validator_hotkey": self.hotkey} |
382 | 383 | header = self.validator_request_header_fn(data) |
383 | 384 | response = requests.post(endpoint, json=data, headers=header) |
@@ -633,7 +634,8 @@ def _update_validators_miner_commits(self): |
633 | 634 | for validator_uid, validator_hotkey in valid_validators: |
634 | 635 | # Skip if request fails |
635 | 636 | try: |
636 | | - endpoint = f"{self.config.STORAGE_API_URL}/fetch-latest-miner-commits" |
| 637 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 638 | + endpoint = f"{storage_url}/fetch-latest-miner-commits" |
637 | 639 | data = { |
638 | 640 | "validator_uid": validator_uid, |
639 | 641 | "validator_hotkey": validator_hotkey, |
@@ -845,7 +847,8 @@ def _store_centralized_scoring(self, challenge_name: str = None): |
845 | 847 | challenge_names = ( |
846 | 848 | [challenge_name] if challenge_name else list(self.scoring_results.keys()) |
847 | 849 | ) |
848 | | - endpoint = f"{self.config.STORAGE_API_URL}/upload-centralized-score" |
| 850 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 851 | + endpoint = f"{storage_url}/upload-centralized-score" |
849 | 852 |
|
850 | 853 | for challenge_name in challenge_names: |
851 | 854 | scoring_results_to_send: list[dict] = [] |
@@ -907,7 +910,8 @@ def _get_accepted_challenge_commits(self, challenge_name: str) -> list: |
907 | 910 | _payload = {"challenge_name": challenge_name} |
908 | 911 | header = self.validator_request_header_fn(_payload) |
909 | 912 |
|
910 | | - endpoint = f"{self.config.STORAGE_API_URL}/fetch-accepted-miner-commits" |
| 913 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 914 | + endpoint = f"{storage_url}/fetch-accepted-miner-commits" |
911 | 915 | commits = requests.post(endpoint, json=_payload, headers=header) |
912 | 916 | if commits.status_code == 200 and commits.json().get("miner_commits"): |
913 | 917 | commits = commits.json().get("miner_commits", []) |
@@ -951,7 +955,8 @@ def _initialize_scoring_cache(self): |
951 | 955 | # Request the most recent entries for this challenge |
952 | 956 | entries_per_challenge = 256 # Match the LRU cache size |
953 | 957 |
|
954 | | - endpoint = f"{self.config.STORAGE_API_URL}/fetch-centralized-score" |
| 958 | + storage_url = str(self.config.STORAGE_API_URL).rstrip("/") |
| 959 | + endpoint = f"{storage_url}/fetch-centralized-score" |
955 | 960 | data = { |
956 | 961 | "challenge_names": [challenge_name], |
957 | 962 | "limit": entries_per_challenge, # Get the most recent entries |
|
0 commit comments