From baef6d0bd9490d0f1ddbacf8bea129e10c998479 Mon Sep 17 00:00:00 2001 From: Romain Primet Date: Fri, 13 Jul 2018 15:55:41 +0200 Subject: [PATCH] handle transient 404 --- tljh/installer.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tljh/installer.py b/tljh/installer.py index 4dd94fd..0ceb417 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -2,6 +2,7 @@ import sys import os import tljh.systemd as systemd import tljh.conda as conda +from urllib.error import HTTPError from urllib.request import urlopen, URLError from tljh import user import secrets @@ -151,6 +152,13 @@ def ensure_jupyterhub_running(times=4): continue # Everything else should immediately abort 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))