Skip to content

Commit 4e668f9

Browse files
committed
refactor: update logging for better visualization
1 parent d733541 commit 4e668f9

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

neurons/validator/base_validator.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ def get_revealed_commits(self) -> dict[str, list[MinerChallengeCommit]]:
645645
seen_docker_hub_ids: set[str] = set()
646646

647647
revealed_commits: dict[str, list[MinerChallengeCommit]] = {}
648+
_list_existing_commits = []
649+
_list_revealed_commits = []
650+
_list_skipped_commits = []
648651
for (uid, hotkey), commits in self.miner_commits.items():
649652
for challenge_name, commit in commits.items():
650653
bt.logging.info(
@@ -663,22 +666,34 @@ def get_revealed_commits(self) -> dict[str, list[MinerChallengeCommit]]:
663666
challenge_name
664667
].get_unique_scored_docker_hub_ids()
665668
):
666-
# Only reveal unique docker hub ids in one pass, also ignore if docker_hub_id has been scored
667-
bt.logging.info(
668-
f"[GET REVEALED COMMITS] Skipping commit, Already revealed: {uid} - {hotkey}"
669+
_list_existing_commits.append(
670+
f"{challenge_name}-{uid}-{hotkey}-{docker_hub_id}"
669671
)
670672
continue
671673
else:
672674
commit.docker_hub_id = docker_hub_id
673675
this_challenge_revealed_commits.append(commit)
674676
seen_docker_hub_ids.add(docker_hub_id)
675-
bt.logging.info(
676-
f"[GET REVEALED COMMITS] Revealed commit: {uid} - {hotkey} - {challenge_name} - {commit.encrypted_commit}"
677+
_list_revealed_commits.append(
678+
f"{challenge_name}-{uid}-{hotkey}-{docker_hub_id}"
677679
)
678680
else:
679-
bt.logging.info(
680-
f"[GET REVEALED COMMITS] Skipping commit: Not revealed yet: {uid} - {hotkey}"
681+
_list_skipped_commits.append(
682+
f"{challenge_name}-{uid}-{hotkey}-{commit.encrypted_commit}"
681683
)
684+
for list_name, list_data in [
685+
("Existing", sorted(_list_existing_commits)),
686+
("Revealed", sorted(_list_revealed_commits)),
687+
("Skipped", sorted(_list_skipped_commits)),
688+
]:
689+
if list_data:
690+
bt.logging.info(
691+
f"[GET REVEALED COMMITS] {list_name} commits: {'\n'.join(list_data)}"
692+
)
693+
else:
694+
bt.logging.info(
695+
f"[GET REVEALED COMMITS] No {list_name.lower()} commits"
696+
)
682697

683698
return revealed_commits
684699

0 commit comments

Comments
 (0)