mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
handle 404 and 503 transient errors
This commit is contained in:
@@ -145,16 +145,16 @@ def ensure_jupyterhub_running(times=4):
|
|||||||
print('Waiting for JupyterHub to come up ({}/{} tries)'.format(i + 1, times))
|
print('Waiting for JupyterHub to come up ({}/{} tries)'.format(i + 1, times))
|
||||||
urlopen('http://127.0.0.1')
|
urlopen('http://127.0.0.1')
|
||||||
return
|
return
|
||||||
except URLError as e:
|
except HTTPError as h:
|
||||||
if isinstance(e.reason, ConnectionRefusedError):
|
if h.code in [404, 503]:
|
||||||
# Hub isn't up yet, sleep & loop
|
# May be transient
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
# Everything else should immediately abort
|
# Everything else should immediately abort
|
||||||
raise
|
raise
|
||||||
except HTTPError as h:
|
except URLError as e:
|
||||||
if h.code in [404, 503]:
|
if isinstance(e.reason, ConnectionRefusedError):
|
||||||
# May be transient
|
# Hub isn't up yet, sleep & loop
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
# Everything else should immediately abort
|
# Everything else should immediately abort
|
||||||
|
|||||||
Reference in New Issue
Block a user