File size: 1,245 Bytes
8fae8f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
source /opt/google/c2d-utils

ANACONDA_PATH="/opt/conda/bin/jupyter"
if [[ "${ENABLE_MULTI_ENV,,}" == 'true' ]]; then
  ANACONDA_PATH="/opt/conda/envs/jupyterlab/bin/jupyter"
fi

#Configure gcloud for Dataproc Extension
set_cloud_sdk_config

# Check Dataproc extension logic for containers is now done in entry point.
disable_mixer=$(get_attribute_value disable-mixer)
if [[ ${disable_mixer,,} == "true" ]]; then
  "${ANACONDA_PATH}" server extension disable dataproc_jupyter_plugin
  "${ANACONDA_PATH}" labextension disable dataproc_jupyter_plugin
else
  "${ANACONDA_PATH}" server extension enable dataproc_jupyter_plugin
  "${ANACONDA_PATH}" labextension enable dataproc_jupyter_plugin
fi

# Toggle terminal
terminal_disabled=$(get_attribute_value notebook-disable-terminal)
if [[ ${terminal_disabled,,} == "true" ]]; then
  "${ANACONDA_PATH}" server extension disable jupyter_server_terminals
else
  "${ANACONDA_PATH}" server extension enable jupyter_server_terminals
fi

if [[ -n "${NOTEBOOK_DISABLE_ROOT}" ]]; then
  "${ANACONDA_PATH}" lab --ip 0.0.0.0 --config=/opt/jupyter/.jupyter/jupyter_notebook_config.py
else
  "${ANACONDA_PATH}" lab --allow-root --ip 0.0.0.0 --config=/opt/jupyter/.jupyter/jupyter_notebook_config.py
fi