@@ -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