Skip to content
Merged
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
11 changes: 0 additions & 11 deletions QPU/dwave_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,6 @@ def _midstream_budget_ok(
self._inloop_pacing_rl.reset()
return MidstreamBudget(should_mine=should_mine, stats=stats)

def _participation_extra(self) -> Dict[str, Any]:
"""QPU adds the reservoir pool at dispatch to the participation marker.

The snapshot is the QPU runway on hand when mining began for this
solution # (>= ``min_block_budget``). Returns ``{}`` when no budget is
configured.
"""
if self.time_manager is None:
return {}
return {"budget_seconds": self.time_manager.get_stats()["pool_seconds"]}

def _adapt_mining_params(
self,
current_requirements: BlockRequirements,
Expand Down
10 changes: 4 additions & 6 deletions quip_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@
# 5,10,20,40,45,45,45s ≈ 3.5 minutes) before failing the startup hard. The
# node descriptor is filed right after register_miner, so its remark can race
# the registration extrinsic's nonce (stale `accountNextIndex` for ~a block);
# the retry rides that out. The per-round "participating" remark is separate
# and stays best-effort — it is not gated here.
# the retry rides that out.
_STARTUP_RETRY_ATTEMPTS = 8
_STARTUP_RETRY_BASE_DELAY_SECONDS = 5.0
_STARTUP_RETRY_MAX_DELAY_SECONDS = 45.0
Expand Down Expand Up @@ -227,10 +226,9 @@ async def _auto_identify(
fatal startup requirement: a descriptor that can't be built/validated
fails immediately (operator misconfiguration), and submission is retried
over several minutes before failing hard via the ``descriptor-failed`` CLI
code. The per-round "participating" remark is a separate, best-effort
signal and is not gated here. The descriptor's `miners` block is built
from the same TOML-shaped dict that `MinerCore` used to spawn worker
handles, so the descriptor always reflects the actual launched topology.
code. The descriptor's `miners` block is built from the same TOML-shaped
dict that `MinerCore` used to spawn worker handles, so the descriptor
always reflects the actual launched topology.
"""
effective_name = (node_name or _default_node_name())[:64]
# When the operator did not configure public_host, query
Expand Down
29 changes: 0 additions & 29 deletions shared/base_miner.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ def mine_work_item(
stop_event: multiprocessing.synchronize.Event,
preview_cb: Optional[Any] = None,
budget_cb: Optional[Any] = None,
participating_cb: Optional[Any] = None,
**kwargs,
) -> Optional[MiningResult]:
"""Protocol-neutral mining loop.
Expand Down Expand Up @@ -716,13 +715,6 @@ def mine_work_item(
``QPUTimeManager.get_stats`` shape) so the controller can
surface live usage on telemetry. Default ``None`` = no-op. A
failing callback never breaks mining.
participating_cb: Optional callable invoked exactly once per
accepted dispatch (after ``_pre_mine_setup`` passes its gate,
so a budget-starved QPU dispatch that aborts never fires it).
Receives ``(solution_number, extra_dict)`` where ``extra_dict``
is ``self._participation_extra()`` (QPU adds ``budget_seconds``).
Drives the controller's write-once participation remark.
Default ``None`` = no-op; a failing callback never breaks mining.
**kwargs: Forwarded to ``_pre_mine_setup``.

Returns:
Expand All @@ -736,18 +728,6 @@ def mine_work_item(
is_substrate = setup.is_substrate
desc_q = setup.desc_q

# Dispatch accepted (gate passed): emit the write-once participation
# signal. For QPU this only runs once the reservoir buffer is reached,
# since a budget-starved dispatch aborts in _setup_dispatch above.
if participating_cb is not None:
try:
participating_cb(
loop_state.solution_number_for_log,
self._participation_extra(),
)
except Exception as exc: # noqa: BLE001 — observability path
self.logger.debug("participating_cb failed (ignored): %s", exc)

progress = 0
try:
while self.mining and not stop_event.is_set():
Expand Down Expand Up @@ -1557,15 +1537,6 @@ def _midstream_budget_ok(
"""
return None

def _participation_extra(self) -> Dict[str, Any]:
"""Extra fields for the per-dispatch participation marker.

Base returns ``{}`` (CPU/GPU have no reservoir). The QPU subclass adds
``{"budget_seconds": <pool at dispatch>}`` so the controller's remark
records the QPU runway committed to this solution #.
"""
return {}

def _pause_driver(self, generation: int) -> None:
"""Tell the persistent driver to stop submitting NEW work (drain-idle).

Expand Down
22 changes: 0 additions & 22 deletions shared/miner_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,32 +313,10 @@ def _emit_preview(payload: Dict[str, Any]) -> None:
def _emit_budget(stats: Dict[str, Any]) -> None:
_emit("budget", stats)

# Write-once participation channel. The miner calls this exactly
# once per accepted dispatch (after its budget gate passes) with the
# solution number + backend-specific extras (QPU: budget_seconds).
# The controller dedups and submits the participation remark.
# Best-effort: a put failure must not break mining.
def _emit_participating(
solution_number: int, extra: Dict[str, Any],
) -> None:
try:
resp_q.put(
{
"op": "participating",
"id": spec.get("id"),
"solution_number": solution_number,
"kind": spec.get("kind"),
**(extra or {}),
}
)
except Exception as exc: # noqa: BLE001 — best-effort
logger.debug("participating put failed (ignored): %s", exc)

try:
result = miner.mine_work_item(
context, stop_event, preview_cb=_emit_preview,
budget_cb=_emit_budget,
participating_cb=_emit_participating,
)
except Exception as exc:
logger.error(
Expand Down
Loading