Fixed some issues

This commit is contained in:
GeorgianaElena
2019-02-11 09:24:16 +02:00
parent eee29a0957
commit 3ee387cd3b
10 changed files with 89 additions and 47 deletions

View File

@@ -84,34 +84,4 @@ def check_service_active(name):
], check=True)
return True
except subprocess.CalledProcessError:
return False
def check_hub_ready():
"""
Check if the hub is ready
"""
try:
last_restart = subprocess.check_output([
'systemctl',
'show',
'jupyterhub',
'-p',
'ActiveEnterTimestamp'
]).decode().strip()
last_restart = " ".join(last_restart.split(" ")[-3:-1])
out = subprocess.check_output([
'journalctl',
'-u',
'jupyterhub',
'--since',
last_restart
])
if "JupyterHub is now running at" in out.decode():
return True
except subprocess.CalledProcessError:
return False
return False