This is an automated email from the ASF dual-hosted git repository. lfrolov pushed a commit to branch DATALAB-2372 in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit c32b4c1e71e759ac295bb7b6f8dae5246285ee21 Author: leonidfrolov <[email protected]> AuthorDate: Thu Aug 26 17:49:18 2021 +0300 [DATALAB-2372]: change how java_home is obtained for deeplearning and how image is chosen --- infrastructure-provisioning/src/general/lib/os/fab.py | 6 +++++- .../src/general/scripts/azure/common_prepare_notebook.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py index f873b56..435efd8 100644 --- a/infrastructure-provisioning/src/general/lib/os/fab.py +++ b/infrastructure-provisioning/src/general/lib/os/fab.py @@ -296,7 +296,11 @@ def configure_jupyter(os_user, jupyter_conf_file, templates_dir, jupyter_version # http_proxy)) #sudo('sed -i \'/\[Service\]/ a\Environment=\"HTTPS_PROXY={}\"\' /tmp/jupyter-notebook.service'.format( # https_proxy)) - java_home = conn.run("update-alternatives --query java | grep -o --color=never \'/.*/java-8.*/jre\'").stdout.splitlines()[0] + 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/jupyter-notebook.service'.format( java_home)) conn.sudo('\cp /tmp/jupyter-notebook.service /etc/systemd/system/jupyter-notebook.service') diff --git a/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py b/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py index 53b767a..d37735a 100644 --- a/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py +++ b/infrastructure-provisioning/src/general/scripts/azure/common_prepare_notebook.py @@ -116,8 +116,13 @@ if __name__ == "__main__": print('Searching pre-configured images') notebook_config['image_name'] = os.environ['azure_{}_image_name'.format(os.environ['conf_os_family'])] if os.environ['conf_deeplearning_cloud_ami'] == 'true' and os.environ['application'] == 'deeplearning': - notebook_config['image_name'] = os.environ['notebook_image_name'] - print('Pre-configured deeplearning image found. Using: {}'.format(notebook_config['image_name'])) + if AzureMeta.get_image(notebook_config['resource_group_name'], notebook_config['expected_image_name']): + notebook_config['image_name'] = notebook_config['expected_image_name'] + notebook_config['image_type'] = 'pre-configured' + print('Pre-configured image found. Using: {}'.format(notebook_config['image_name'])) + else: + notebook_config['image_name'] = os.environ['notebook_image_name'] + print('Pre-configured deeplearning image found. Using: {}'.format(notebook_config['image_name'])) else: notebook_config['notebook_image_name'] = (lambda x: '{0}-{1}-{2}-{3}-{4}'.format( notebook_config['service_base_name'], notebook_config['project_name'], notebook_config['endpoint_name'], --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
