Выполнение работы на 4.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Wait for the public LB to route requests to a ready API replica."""
|
||||
import argparse
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
p = argparse.ArgumentParser()
|
||||
p.add_argument('--base-url', default='http://localhost:18084')
|
||||
args = p.parse_args()
|
||||
deadline = time.monotonic()+90
|
||||
while True:
|
||||
try:
|
||||
with urllib.request.urlopen(args.base_url.rstrip('/')+'/health/ready', timeout=3) as response:
|
||||
if response.status == 200:
|
||||
print('PASS: API is ready through the load balancer.')
|
||||
break
|
||||
except (urllib.error.URLError, OSError):
|
||||
pass
|
||||
if time.monotonic() >= deadline:
|
||||
raise SystemExit('FAIL: API did not become ready in 90 seconds')
|
||||
time.sleep(.5)
|
||||
Reference in New Issue
Block a user