Wait for S3 to turn healthy after the paused pass
docker compose up --wait failed at once after unpausing S3: the probes that ran while it was paused had already marked it unhealthy. The demo now polls the health status of the container until it is healthy again. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1d3RLHNBBMA6UqBLLJv27
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f1ee385a1b
commit
21937f920f
@@ -303,6 +303,16 @@ def single(check):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def healthy(service, seconds=90):
|
||||||
|
container = compose("ps", "-q", service).strip()
|
||||||
|
probe = ["docker", "inspect", "-f", "{{.State.Health.Status}}", container]
|
||||||
|
deadline = time.monotonic() + seconds
|
||||||
|
while must(probe).strip() != "healthy":
|
||||||
|
if time.monotonic() > deadline:
|
||||||
|
raise SystemExit(f"{service} is not healthy after {seconds} s")
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
||||||
def interrupt(check):
|
def interrupt(check):
|
||||||
name = f"lab4-reconcile-sigterm-{os.getpid()}"
|
name = f"lab4-reconcile-sigterm-{os.getpid()}"
|
||||||
compose("pause", "s3")
|
compose("pause", "s3")
|
||||||
@@ -322,7 +332,7 @@ def interrupt(check):
|
|||||||
code = runner.wait(timeout=60)
|
code = runner.wait(timeout=60)
|
||||||
finally:
|
finally:
|
||||||
compose("unpause", "s3")
|
compose("unpause", "s3")
|
||||||
compose("up", "-d", "--wait", "--no-deps", "s3")
|
healthy("s3")
|
||||||
after = reconcile("--dry-run", *FLAGS)
|
after = reconcile("--dry-run", *FLAGS)
|
||||||
status, init = state.split()
|
status, init = state.split()
|
||||||
report = {
|
report = {
|
||||||
|
|||||||
Reference in New Issue
Block a user