This repository was archived by the owner on Feb 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit * enable jupyter lab as a default plugin * remove hack text and add more logging * remove docker compose code. it is not used yet * remove unused code and comment
- Loading branch information
Showing
7 changed files
with
85 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .hdfs import * | ||
from .jupyter import * | ||
from .jupyter_lab import * | ||
from .rstudio_server import * |
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 .configuration import * |
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,23 @@ | ||
import os | ||
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginRunTarget | ||
from aztk.models.plugins.plugin_file import PluginFile | ||
from aztk.utils import constants | ||
|
||
dir_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
class JupyterLabPlugin(PluginConfiguration): | ||
def __init__(self): | ||
super().__init__( | ||
name="jupyterlab", | ||
ports=[ | ||
PluginPort( | ||
internal=8889, | ||
public=True, | ||
), | ||
], | ||
run_on=PluginRunTarget.All, | ||
execute="jupyter_lab.sh", | ||
files=[ | ||
PluginFile("jupyter_lab.sh", os.path.join(dir_path, "jupyter_lab.sh")), | ||
], | ||
) |
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,55 @@ | ||
#!/bin/bash | ||
|
||
# This custom script has been tested to work on the following docker images: | ||
# - aztk/python:spark2.2.0-python3.6.2-base | ||
# - aztk/python:spark2.2.0-python3.6.2-gpu | ||
# - aztk/python:spark2.1.0-python3.6.2-base | ||
# - aztk/python:spark2.1.0-python3.6.2-gpu | ||
|
||
if [ "$IS_MASTER" = "1" ]; then | ||
conda install -c conda-force jupyterlab | ||
|
||
PYSPARK_DRIVER_PYTHON="/.pyenv/versions/${USER_PYTHON_VERSION}/bin/jupyter" | ||
JUPYTER_KERNELS="/.pyenv/versions/${USER_PYTHON_VERSION}/share/jupyter/kernels" | ||
|
||
# disable password/token on jupyter notebook | ||
jupyter lab --generate-config --allow-root | ||
JUPYTER_CONFIG='/.jupyter/jupyter_notebook_config.py' | ||
echo >> $JUPYTER_CONFIG | ||
echo -e 'c.NotebookApp.token=""' >> $JUPYTER_CONFIG | ||
echo -e 'c.NotebookApp.password=""' >> $JUPYTER_CONFIG | ||
|
||
# get master ip | ||
MASTER_IP=$(hostname -i) | ||
|
||
# remove existing kernels | ||
rm -rf $JUPYTER_KERNELS/* | ||
|
||
# set up jupyter to use pyspark | ||
mkdir $JUPYTER_KERNELS/pyspark | ||
touch $JUPYTER_KERNELS/pyspark/kernel.json | ||
cat << EOF > $JUPYTER_KERNELS/pyspark/kernel.json | ||
{ | ||
"display_name": "PySpark", | ||
"language": "python", | ||
"argv": [ | ||
"python", | ||
"-m", | ||
"ipykernel", | ||
"-f", | ||
"{connection_file}" | ||
], | ||
"env": { | ||
"SPARK_HOME": "$SPARK_HOME", | ||
"PYSPARK_PYTHON": "python", | ||
"PYSPARK_SUBMIT_ARGS": "--master spark://$MASTER_IP:7077 pyspark-shell" | ||
} | ||
} | ||
EOF | ||
|
||
# start jupyter notebook from /mnt - this is where we recommend you put your azure files mount point as well | ||
cd /mnt | ||
(PYSPARK_DRIVER_PYTHON=$PYSPARK_DRIVER_PYTHON PYSPARK_DRIVER_PYTHON_OPTS="lab --no-browser --port=8889 --allow-root" pyspark &) | ||
fi | ||
|
||
|