Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions neurons/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright © 2023 Yuma Rao
# Copyright © 2023 Mode Labs
import asyncio
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta
import multiprocessing as mp

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
Expand Down Expand Up @@ -128,31 +128,22 @@ async def wait_till_next_simulation(
await asyncio.sleep(wait_time)

async def forward_prompt(self):
# getting current validation time
request_time = get_current_time()

xau_launch_time = datetime(2025, 7, 9, 14, 0, 0, 0, timezone.utc)
simulation_input_list = (
self.simulation_input_list
if request_time > xau_launch_time
else self.simulation_input_list[:2]
)

for simulation_index in range(len(simulation_input_list)):
for simulation_input in self.simulation_input_list:
request_time = get_current_time()
# round validation time to the closest minute and add extra minutes
start_time = round_time_to_minutes(
request_time, 60, self.timeout_extra_seconds
)

if should_skip_xau(start_time):
if should_skip_xau(start_time) and simulation_input.asset == "XAU":
bt.logging.info(
"Skipping XAU simulation as market is closed",
"forward_prompt",
)
await self.wait_till_next_simulation(
request_time, self.simulation_input_list
)
continue

# ================= Step 1 ================= #
# Getting available miners from metagraph and saving information about them
Expand All @@ -174,15 +165,14 @@ async def forward_prompt(self):
await self.wait_till_next_simulation(
request_time, self.simulation_input_list
)
continue

# ================= Step 2 ================= #
# Query all the available miners and save all their responses
# in the database in miner_predictions table
# ========================================== #

# input data: from the list declared above, at the index of the loop
simulation_input = simulation_input_list[simulation_index]
# add the start time
# add the start time to the simulation input
simulation_input.start_time = start_time.isoformat()

await query_available_miners_and_save_responses(
Expand Down