Skip to content

Commit 4b35624

Browse files
committed
Add verbose logs
1 parent 7c153f1 commit 4b35624

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Subnet 1 is the most intelligent inference model on Bittensor. As the first agen
4040

4141
3. **Install the project and its development dependencies:**
4242
```bash
43-
uv venv && uv python install 3.11 && uv python pin 3.11 && uv venv --python=3.11 && uv pip install -e '.[dev]'
43+
uv venv --python=3.11 && uv pip install '.[dev]'
4444
```
4545

4646
4. **Activate python environment:**

apex/validator/miner_scorer.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ async def set_scores(self) -> bool:
5050
expose each one as plain python objects so that downstream code can work with them,
5151
and remove rows that are older than the time window.
5252
"""
53+
logger.debug("Retrieving miner's performance history")
5354
async with self._db() as conn: # type: aiosqlite.Connection
5455
# Calculate the cutoff timestamp (current time - window hours).
5556
cutoff_timestamp = int(time.time() - SCORE_MA_WINDOW_HOURS * 3600)
@@ -70,6 +71,7 @@ async def set_scores(self) -> bool:
7071
return False
7172

7273
# 2. Iterate over the in-memory list so that the caller can process freely.
74+
logger.debug("Pre-processing miner's rewards")
7375
hkey_agg_rewards: dict[str, float] = {}
7476
for generator_hotkey, generator_score, disc_hotkeys_json, disc_scores_json in rows:
7577
# Deserialize JSON columns.
@@ -88,6 +90,7 @@ async def set_scores(self) -> bool:
8890
hkey_agg_rewards[hotkey] = float(hkey_agg_rewards.get(hotkey, 0.0)) + float(reward)
8991

9092
# 3. Delete rows that are older than the time window.
93+
logger.debug("Cleaning up miner's outdated history")
9194
await conn.execute(
9295
"DELETE FROM discriminator_results WHERE timestamp < ?",
9396
(cutoff_timestamp,),
@@ -102,8 +105,10 @@ async def set_scores(self) -> bool:
102105
record_str: str = json.dumps(record)
103106
fh.write(f"{record_str}\n")
104107
# TODO: Flush the db only on set_weights_result is True.
108+
logger.debug("Setting weights")
105109
set_weights_result = await self.chain.set_weights(hkey_agg_rewards)
106110

107111
# 4. Flush all deletions in a single commit.
112+
logger.debug("Updating rewards DB")
108113
await conn.commit()
109114
return set_weights_result

0 commit comments

Comments
 (0)