mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-08 10:34:06 +00:00

* Update docker_healthcheck.py This does not (always) work. Sometimes, other JSON files appear in the directory, like this kernel-xxx file jpserver-6.json jpserver-6-open.html kernel-374f4977-29fc-43e0-8a48-231f6980fdab.json changing the glob expression to something like "jpserver*.json" instead of simply "*.json" should solve the problem (at least in my case, I checked with a quick patch on a live container, the healthcheck immediately turned 'healthy' again...) * Update base-notebook/docker_healthcheck.py * Update docker_healthcheck.py --------- Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com>
22 lines
660 B
Python
Executable File
22 lines
660 B
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import requests
|
|
|
|
# A number of operations below delibrately don't check for possible errors
|
|
# As this is a healthcheck, it should succeed or raise an exception on error
|
|
|
|
runtime_dir = Path("/home/") / os.environ["NB_USER"] / ".local/share/jupyter/runtime/"
|
|
json_file = next(runtime_dir.glob("*server-*.json"))
|
|
|
|
url = json.loads(json_file.read_bytes())["url"]
|
|
url = url + "api"
|
|
|
|
r = requests.get(url, verify=False) # request without SSL verification
|
|
r.raise_for_status()
|
|
print(r.content)
|