handle transient 404

This commit is contained in:
Romain Primet
2018-07-13 15:55:41 +02:00
parent 7c245d0868
commit baef6d0bd9

View File

@@ -2,6 +2,7 @@ import sys
import os import os
import tljh.systemd as systemd import tljh.systemd as systemd
import tljh.conda as conda import tljh.conda as conda
from urllib.error import HTTPError
from urllib.request import urlopen, URLError from urllib.request import urlopen, URLError
from tljh import user from tljh import user
import secrets import secrets
@@ -151,6 +152,13 @@ def ensure_jupyterhub_running(times=4):
continue continue
# Everything else should immediately abort # Everything else should immediately abort
raise raise
except HTTPError as h:
if h.code == 404:
# May be transient
time.sleep(1)
continue
# Everything else should immediately abort
raise
raise Exception("Installation failed: JupyterHub did not start in {}s".format(times)) raise Exception("Installation failed: JupyterHub did not start in {}s".format(times))