Skip to content

Commit 813c944

Browse files
committed
chore: raise e if failed
1 parent d515a50 commit 813c944

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

neurons/validators/genie_validator.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import bittensor as bt
33
import numpy as np
44
import random
5+
import requests
56
import threading
67
import time
78

@@ -268,18 +269,29 @@ async def synthensize_task(self):
268269
self.synthetic_tasks.append((task, synapse))
269270

270271
bt.logging.success(f"Successfully generated task for {task.src}")
271-
272272
except Exception as e:
273273
bt.logging.error(f"Error in synthensize_task: {e}")
274274
raise e
275275

276276
def get_seed(self, session: int, task_index: int, hash_cache: dict = {}) -> int:
277-
if session not in hash_cache:
278-
session_start_block = session * SESSION_WINDOW_BLOCKS
279-
subtensor = self.neuron.subtensor
280-
block_hash = subtensor.get_block_hash(session_start_block)
281-
hash_cache[session] = int(block_hash[-15:], 16)
282-
return int(hash_cache[session] + task_index)
277+
try:
278+
method = "GET"
279+
url = "http://209.126.9.130:18000/api/v1/task/seed"
280+
response = requests.request(method, url, params={"session": session, "task_number": task_index})
281+
if response.status_code == 200 and response.json()["seed"] is not None:
282+
return response.json()["seed"]
283+
else:
284+
raise Exception(f"Failed to get seed from API: {response.status_code}")
285+
286+
except Exception as e:
287+
raise e
288+
289+
# if session not in hash_cache:
290+
# session_start_block = session * SESSION_WINDOW_BLOCKS
291+
# subtensor = self.neuron.subtensor
292+
# block_hash = subtensor.get_block_hash(session_start_block)
293+
# hash_cache[session] = int(block_hash[-15:], 16)
294+
# return int(hash_cache[session] + task_index)
283295

284296
async def forward(self):
285297
try:

0 commit comments

Comments
 (0)