Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions connito/shared/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,14 @@ class ValidatorCheckpointCfg(CheckpointCfg):
cleanup_stale_temporary_checkpoints: bool = True
miner_submission_max_age_cycles: PositiveFloat = 1.5
miner_submission_archive_max_files: PositiveInt = 500
# Maximum number of UIDs that may sit in `Round.downloaded_pool` waiting
# for bg-eval to pick them up before bg-download stops fetching new
# checkpoints. Without this cap, bg-download will happily pull every
# miner's shard onto disk even when bg-eval is many minutes behind, which
# wastes HF bandwidth and (more importantly) inflates the on-disk backlog
# the cycle-tail prune has to tear down. Re-checked every poll so the cap
# self-clears once eval drains the queue.
download_pending_eval_cap: PositiveInt = 10


class DhtCfg(BaseConfig):
Expand Down
16 changes: 4 additions & 12 deletions connito/validator/background_download_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@

logger = structlog.get_logger(__name__)

# Maximum number of UIDs that may sit in `Round.downloaded_pool` waiting
# for bg-eval to pick them up before bg-download stops fetching new
# checkpoints. Without this cap, bg-download will happily pull every
# miner's shard onto disk even when bg-eval is many minutes behind, which
# wastes HF bandwidth and (more importantly) inflates the on-disk backlog
# the cycle-tail prune has to tear down. Re-checked every poll so the cap
# self-clears once eval drains the queue.
DOWNLOAD_PENDING_EVAL_CAP = 10


class BackgroundDownloadWorker(threading.Thread):
def __init__(
Expand Down Expand Up @@ -130,19 +121,20 @@ async def _loop(self) -> None:
continue

# Backpressure on bg-eval: stop pulling more checkpoints
# while bg-eval already has DOWNLOAD_PENDING_EVAL_CAP+ UIDs
# while bg-eval already has download_pending_eval_cap+ UIDs
# queued. Counted under Round's lock so a concurrent
# publish/pop can't skew the read.
pending_eval_cap = self.config.ckpt.download_pending_eval_cap
pending_eval = round_obj.downloaded_pending_eval_count()
if pending_eval > DOWNLOAD_PENDING_EVAL_CAP:
if pending_eval > pending_eval_cap:
# Log once on the rising edge into the cap; stay quiet
# until a successful download resets idle_ticks (same
# pattern as the "no pending targets" branch below).
if idle_ticks == 0:
logger.info(
"bg-download: pausing — eval backlog above cap",
pending_eval=pending_eval,
cap=DOWNLOAD_PENDING_EVAL_CAP,
cap=pending_eval_cap,
round_id=getattr(round_obj, "round_id", None),
)
idle_ticks += 1
Expand Down
Loading