-
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.
- Loading branch information
Showing
12 changed files
with
181 additions
and
63 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
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
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
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
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,11 @@ | ||
from exasol.ds.sandbox.cli.cli import cli | ||
from exasol.ds.sandbox.lib.dss_docker import DssDockerImage | ||
|
||
@cli.command() | ||
def create_dss_docker_image(): | ||
""" | ||
Create a Docker image for data-science-sandbox and deploy | ||
it to https://hub.docker.com/exasol/data-science-sandbox. | ||
""" | ||
print("Hello this is create_dss_docker_image") | ||
# DssDockerImage.for_production().create() |
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 @@ | ||
from .create_image import DssDockerImage |
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
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
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 |
---|---|---|
|
@@ -13,3 +13,6 @@ | |
ansible.builtin.file: | ||
path: /root/.cache/pip | ||
state: absent | ||
- name: Install Docker | ||
include_role: | ||
name: docker |
2 changes: 1 addition & 1 deletion
2
exasol/ds/sandbox/runtime/ansible/roles/jupyter/files/requirements_dependencies.txt
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
uncertainties==3.1.7 | ||
numpy==1.23.1 | ||
pandas==1.4.3 | ||
exasol-notebook-connector==0.1.0 | ||
exasol-notebook-connector==0.2.0 |
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,65 @@ | ||
import docker | ||
import logging | ||
import pytest | ||
import requests | ||
import time | ||
|
||
from exasol.ds.sandbox.lib.dss_docker import DssDockerImage | ||
from datetime import datetime | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def dss_docker_container(): | ||
timestamp = f'{datetime.now().timestamp():.0f}' | ||
# testee = DssDockerImage(f"dss_container_{timestamp}", f"dss_image_{timestamp}", logging.INFO) | ||
testee = DssDockerImage("ds-sandbox-docker", f"dss_image_{timestamp}", logging.INFO) | ||
print( | ||
"\n- Using" | ||
f' Docker container {testee.container_name}' | ||
f' with image {testee.image_name}' | ||
) | ||
testee.create() | ||
client = docker.from_env() | ||
mapped_ports = {'8888/tcp': 8888} | ||
container = client.containers.create( | ||
image=testee.image_name, | ||
name=testee.container_name, | ||
command="sleep infinity", | ||
detach=True, | ||
ports=mapped_ports, | ||
) | ||
container.start() | ||
try: | ||
yield container | ||
finally: | ||
pass | ||
container.stop() | ||
container.remove() | ||
client.images.remove(testee.image_name) | ||
|
||
|
||
def test_jupyterlab(dss_docker_container): | ||
"""" | ||
Test that jupyterlab is configured properly | ||
""" | ||
jupyter_command = ( | ||
"/root/jupyterenv/bin/jupyter-lab" | ||
" --notebook-dir=/root/notebooks" | ||
" --no-browser" | ||
" --allow-root" | ||
) | ||
container = dss_docker_container | ||
container.exec_run(jupyter_command, detach=True) | ||
time.sleep(5.0) | ||
container.reload() | ||
ip_address = container.attrs['NetworkSettings']['IPAddress'] | ||
http_conn = requests.get(f"http://{ip_address}:8888/lab") | ||
assert http_conn.status_code == 200 | ||
|
||
|
||
def test_install_notebook_connector(dss_docker_container): | ||
container = dss_docker_container | ||
command = '/root/jupyterenv/bin/python -c "import exasol.secret_store"' | ||
exit_code, output = container.exec_run(command) | ||
output = output.decode('utf-8').strip() | ||
assert exit_code == 0, f'Got output "{output}".' |
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,17 @@ | ||
import logging | ||
|
||
from exasol.ds.sandbox.lib.dss_docker import DssDockerImage | ||
|
||
|
||
def test_for_production(): | ||
testee = DssDockerImage.for_production() | ||
assert testee.container_name == DssDockerImage.DEFAULT_CONTAINER_NAME | ||
assert testee.image_name == DssDockerImage.DEFAULT_IMAGE_NAME | ||
assert testee.log_level == logging.INFO | ||
|
||
|
||
def test_constructor(): | ||
testee = DssDockerImage("cont", "img", logging.ERROR) | ||
assert testee.container_name == "cont" | ||
assert testee.image_name == "img" | ||
assert testee.log_level == logging.ERROR |