You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by ol...@apache.org on 2022/02/21 09:24:36 UTC
[incubator-datalab] 02/02: solved merge conflict
This is an automated email from the ASF dual-hosted git repository.
olehmykolaishyn pushed a commit to branch 2.5.1-tensor-jupyterlab
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 17aa84143ffe2c2ca9883f876c243dd7a73c0835
Merge: 6c75bb9 b1e79ac
Author: oleh_mykolaishyn <ow...@gmail.com>
AuthorDate: Mon Feb 21 11:23:37 2022 +0200
solved merge conflict
.../src/general/conf/datalab.ini | 4 ++--
.../src/general/lib/os/fab.py | 14 +++++++++++++-
.../scripts/aws/tensor-jupyterlab_configure.py | 12 ++++++------
.../templates/os/debian/jupyterlab-notebook.service | 8 ++++----
.../scripts/configure_tensor-jupyterlab_node.py | 20 +++++++++++++-------
.../backendapi/service/impl/ProjectServiceImpl.java | 7 ++++++-
.../datalab/backendapi/domain/NotebookTemplate.java | 2 +-
7 files changed, 45 insertions(+), 22 deletions(-)
diff --cc infrastructure-provisioning/src/general/lib/os/fab.py
index ef85375,51bd7f7..9bf7449
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@@ -1047,29 -1047,53 +1047,40 @@@ def configure_jupyter(os_user, jupyter_
def configure_jupyterlab(os_user, jupyterlab_conf_file, templates_dir, jupyterlab_version, exploratory_name):
if not exists(conn, '/home/' + os_user + '/.ensure_dir/jupyterlab_ensured'):
try:
- conn.sudo('source /opt/python/python3.7.9/bin/activate')
- # conn.sudo('pip3 install notebook=={} --no-cache-dir'.format(jupyter_version))
- # conn.sudo('source /opt/python/python3.7.9/bin/activate')
+ conn.sudo('pip3 install jupyterlab --no-cache-dir') # create external var with version
conn.sudo('rm -rf {}'.format(jupyterlab_conf_file))
conn.run('jupyter lab --generate-config')
- #conn.run('mkdir -p ~/.jupyter/custom/')
- #conn.run('echo "#notebook-container { width: auto; }" > ~/.jupyter/custom/custom.css')
conn.sudo('echo "c.NotebookApp.ip = \'0.0.0.0\'" >> {}'.format(jupyterlab_conf_file))
conn.sudo('echo "c.NotebookApp.base_url = \'/{0}/\'" >> {1}'.format(exploratory_name, jupyterlab_conf_file))
conn.sudo('echo c.NotebookApp.open_browser = False >> {}'.format(jupyterlab_conf_file))
conn.sudo('echo \'c.NotebookApp.cookie_secret = b"{0}"\' >> {1}'.format(id_generator(), jupyterlab_conf_file))
conn.sudo('''echo "c.NotebookApp.token = u''" >> {}'''.format(jupyterlab_conf_file))
conn.sudo('echo \'c.KernelSpecManager.ensure_native_kernel = False\' >> {}'.format(jupyterlab_conf_file))
+ conn.put(templates_dir + 'jupyterlab-notebook.service', '/tmp/jupyterlab-notebook.service')
- #conn.sudo('cp /root/templates/jupyterlab-notebook.service /tmp/jupyter-notebook.service')
- #if os.environ['conf_deeplearning_cloud_ami'] == 'true' and os.environ['application'] == 'deeplearning':
- # conn.sudo(
- # '''echo "c.NotebookApp.kernel_spec_manager_class = 'environment_kernels.EnvironmentKernelSpecManager'" >> {}'''.format(
- # jupyter_conf_file))
- # conn.sudo(
- # '''echo "c.EnvironmentKernelSpecManager.conda_env_dirs=['/home/ubuntu/anaconda3/envs']" >> {}'''.format(
- # jupyter_conf_file))
- #conn.put(templates_dir + 'jupyter-notebook.service', '/tmp/jupyter-notebook.service')
- #conn.sudo("chmod 644 /tmp/jupyter-notebook.service")
- #if os.environ['application'] == 'tensor': # ?????
- # conn.sudo(
- # "sed -i '/ExecStart/s|-c \"|-c \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cudnn/lib64:/usr/local/cuda/lib64; |g' /tmp/jupyter-notebook.service")
- #elif os.environ['application'] == 'deeplearning' and os.environ['conf_deeplearning_cloud_ami'] == 'false':
- # conn.sudo(
- # "sed -i '/ExecStart/s|-c \"|-c \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cudnn/lib64:/usr/local/cuda/lib64:/usr/lib64/openmpi/lib: ; export PYTHONPATH=/home/" + os_user +
- # "/caffe/python:/home/" + os_user + "/pytorch/build:$PYTHONPATH ; |g' /tmp/jupyter-notebook.service")
- #conn.sudo("sed -i 's|CONF_PATH|{}|' /tmp/jupyter-notebook.service".format(jupyter_conf_file))
- #conn.sudo("sed -i 's|OS_USR|{}|' /tmp/jupyter-notebook.service".format(os_user))
if os.environ['application'] == 'deeplearning' and os.environ['conf_cloud_provider'] == 'azure':
java_home = conn.run("update-alternatives --query java | grep -o --color=never \'/.*/java-11.*/bin/java\'").stdout.splitlines()[0]
else:
java_home = conn.run("update-alternatives --query java | grep -o --color=never \'/.*/java-8.*/jre\'").stdout.splitlines()[0]
+ conn.sudo('sed -i \'/\[Service\]/ a\Environment=\"JAVA_HOME={}\"\' /tmp/jupyterlab-notebook.service'.format(
+ java_home))
+ conn.sudo('\cp /tmp/jupyterlab-notebook.service /etc/systemd/system/jupyterlab-notebook.service')
+ conn.sudo('chown -R {0}:{0} /home/{0}/.local'.format(os_user))
+ conn.sudo('mkdir -p /mnt/var')
+ conn.sudo('chown {0}:{0} /mnt/var'.format(os_user))
+ conn.sudo("systemctl daemon-reload")
+ conn.sudo("systemctl enable jupyterlab-notebook")
+ conn.sudo("systemctl start jupyterlab-notebook")
+ conn.sudo('touch /home/{}/.ensure_dir/jupyterlab_ensured'.format(os_user))
+ #conn.sudo('sed -i \'/\[Service\]/ a\Environment=\"JAVA_HOME={}\"\' /tmp/jupyterlab-notebook.service'.format(
+ # java_home))
+ conn.sudo('cp /tmp/jupyterlab-notebook.service /etc/systemd/system/jupyterlab-notebook.service')
+ conn.sudo("systemctl daemon-reload")
+ conn.sudo("systemctl enable jupyterlab-notebook")
+ conn.sudo("systemctl start jupyterlab-notebook")
+ #conn.sudo('chown -R {0}:{0} /home/{0}/.local'.format(os_user))
+ #conn.sudo('mkdir -p /mnt/var')
+ #conn.sudo('chown {0}:{0} /mnt/var'.format(os_user))
- conn.sudo('touch /home/{}/.ensure_dir/jupyter_ensured'.format(os_user))
++ conn.sudo('touch /home/{}/.ensure_dir/jupyterlab_ensured'.format(os_user))
except Exception as err:
logging.error('Function configure_jupyterlab error:', str(err))
traceback.print_exc()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org