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
15 changes: 1 addition & 14 deletions benchmark/edgebench/checkpoint_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from urllib.request import HTTPRedirectHandler, ProxyHandler, Request, build_opener

from loopx.control_plane.effect_runtime import effect_runtime_result
from benchmark.runtime.docker_checkpoint import _physical, _remaining
from benchmark.runtime.scheduler import read_phase_deadline
from benchmark.runtime.worker import PHASE_WORK_RESERVE_SECONDS

Expand All @@ -33,13 +34,6 @@ def redirect_request(self, req, fp, code, msg, headers, newurl):
return None # Never forward controller credentials to another origin.


def _physical(path: Path) -> Path:
path = Path(path)
if not path.is_absolute() or path.resolve(strict=True) != path:
raise ValueError("Controller paths must be normalized, physical and absolute")
return path


def _controller(path: Path) -> dict:
path = _physical(path)
if path.stat().st_mode & 0o077:
Expand Down Expand Up @@ -183,13 +177,6 @@ def _activation_result(result: dict, body: dict) -> None:
raise ValueError("Native activation result differs from the original request")


def _remaining(deadline: float) -> float:
remaining = deadline - time.monotonic()
if remaining <= 0:
raise TimeoutError("Checkpoint capture window closed")
return remaining


def capture(controller_file: Path, *, token: str, capture_id: str, destination: Path,
timeout: float = 30, phase_deadline_file: Path | None = None) -> dict:
"""Capture one native-owned point without exporting controller configuration."""
Expand Down
13 changes: 8 additions & 5 deletions benchmark/edgebench/checkpoint_supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
from pathlib import Path

from loopx.control_plane.effect_runtime import EffectRuntimeRemoteError
from benchmark.runtime.docker_checkpoint import (
_archive, _guest_path, capture_failure_fields, qualify_export_storage, validate_worker_request,
)
from benchmark.runtime.layout import _ACTIVE_PHASE_DEADLINE, _PHASE_DEADLINE

from .checkpoint_controller import _controller
from .checkpoint_worker import (
_archive, _guest_path, _validate_request, capture_failure_fields, capture_worker, qualify_export_storage,
)
from .checkpoint_worker import capture_worker


class CheckpointSupervisor:
Expand All @@ -36,8 +37,10 @@ def __init__(self, controller_file: Path, destination: Path, retention_policy: P
from .terminal_capture import FailurePreservation
if terminal_receipt is None or terminal_receipt.exists():
raise ValueError("Terminal preservation requires a fresh private receipt")
_validate_request({"container_id": "0" * 64, "components": terminal_components,
"phase_deadline_path": phase_deadline_path})
validate_worker_request({
"container_id": "0" * 64, "components": terminal_components,
"phase_deadline_path": phase_deadline_path,
})
self.preservation = FailurePreservation(self, terminal_components, terminal_receipt)
self.token = None
self.stop = threading.Event()
Expand Down
430 changes: 22 additions & 408 deletions benchmark/edgebench/checkpoint_worker.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion benchmark/edgebench/cli_source_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from loopx.control_plane.effect_runtime import effect_runtime_result
from loopx.file_lock import exclusive_file_lock, write_json_atomic
from .checkpoint_worker import _worker_lock
from benchmark.runtime.docker_checkpoint import _worker_lock
from .cli_source_probe import _archive_response, source_goal_control


Expand Down
2 changes: 1 addition & 1 deletion benchmark/edgebench/cli_source_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import tarfile
import tempfile

from .checkpoint_worker import _guest_path
from benchmark.runtime.docker_checkpoint import _guest_path


def _canonical(value):
Expand Down
2 changes: 1 addition & 1 deletion benchmark/edgebench/stopped_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import time

from .checkpoint_controller import _remaining
from .checkpoint_worker import _archive_component, _guest_path
from benchmark.runtime.docker_checkpoint import _archive_component, _guest_path


def file_inventory(root: Path) -> list[dict]:
Expand Down
8 changes: 4 additions & 4 deletions benchmark/edgebench/terminal_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def terminal_components(declaration: dict, workspace: str) -> list[dict[str, str
))
# Let the shared transport reject aliases/overlaps before launch, rather
# than silently dropping an explicit external research participant.
from benchmark.edgebench.checkpoint_worker import _validate_request
_validate_request({"container_id": "0" * 64, "components": components,
from benchmark.runtime.docker_checkpoint import validate_worker_request
validate_worker_request({"container_id": "0" * 64, "components": components,
"phase_deadline_path": _PHASE_DEADLINE})
return components

Expand All @@ -54,7 +54,7 @@ def _scheduler_components_at_barrier(container, components, stage, *, deadline):
import docker
from benchmark.runtime.layout import _ACTIVE_PHASE_DEADLINE
from benchmark.runtime.scheduler import phase_state_name, read_phase_deadline
from .checkpoint_worker import _archive
from benchmark.runtime.docker_checkpoint import _archive

root = PurePosixPath(_CONTROL, "scheduler-state.json")
if {"id": "terminal_scheduler", "source_path": str(root)} not in components:
Expand Down Expand Up @@ -150,7 +150,7 @@ def finish(self, execution):
self.receipt.update(capture_succeeded=True, capture=point)
except Exception as error:
# No remote message, output, account information or token is retained.
from .checkpoint_worker import capture_failure_fields
from benchmark.runtime.docker_checkpoint import capture_failure_fields

self.receipt.update(capture_failure_fields(error))
finally:
Expand Down
12 changes: 12 additions & 0 deletions benchmark/runtime/RUNTIME.md
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,18 @@ send deadline and remain unknown even when the upstream has received some bytes.

## Results, timeout and recovery

Docker-based controllers can use
`benchmark.runtime.docker_checkpoint.capture_docker_worker` to verify a
prepared capture request, pause the exact source container, and seal its
files and evaluator capsule. Supply the native capture callback and its
bank from the benchmark adapter. The callback runs under the writer barrier
and returns the digest of the capsule it wrote at the assigned destination.
EdgeBench supplies its SForge evaluator and source phase deadline through
this entry point. An operator with a deadline-free solving phase can pass
a null phase path and explicitly allow an open phase. The worker capture
and sealing windows still bound the handoff.


### Live session observation

Frequent capacity and liveness polls may use
Expand Down
Loading
Loading