-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Checks if the docker socket is mounted.
- Loading branch information
Showing
3 changed files
with
116 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/notebook/utils/useful_urls.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "51056cb1-6ee5-413e-a3b6-6ab2890ab887", | ||
"metadata": {}, | ||
"source": [ | ||
"# List of URLs used in the code\n", | ||
"\n", | ||
"<b>This notebook is not supposed to be used on its own.<b>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "d8fffc12-50f6-4f54-8911-75a387cc5245", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from enum import Enum\n", | ||
"\n", | ||
"class UsefulURLs(Enum):\n", | ||
" user_manual_docker_db = 'https://github.com/exasol/ai-lab/blob/main/doc/user_guide/docker/docker-usage.md#ai-lab-with-integrated-exasol-docker-db'" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import nbformat | ||
from nbclient import NotebookClient | ||
|
||
|
||
def test_urls() -> None: | ||
|
||
nb = nbformat.read('utils/useful_urls.ipynb', as_version=4) | ||
|
||
# Add the following code at the end of the notebook | ||
test_code = ''' | ||
def verify_all_urls(): | ||
import requests | ||
bad_urls = [] | ||
for url in UsefulURLs: | ||
try: | ||
response = requests.head(url.value, allow_redirects=True) | ||
if response.status_code >= 400: | ||
bad_urls.append(url.value) | ||
except requests.RequestException: | ||
bad_urls.append(url.value) | ||
if bad_urls: | ||
raise RuntimeError(f"The following URL(s) are inaccessible {bad_urls}") | ||
verify_all_urls() | ||
''' | ||
nb.cells.append(nbformat.v4.new_code_cell(test_code)) | ||
|
||
# Execute the notebook object, expecting to get no exceptions. | ||
nb_client = NotebookClient(nb, kernel_name='python3') | ||
nb_client.execute() |