This is an automated email from the ASF dual-hosted git repository.

olehmykolaishyn pushed a commit to branch gcp-jupyter-highgpu-template-1
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/gcp-jupyter-highgpu-template-1 
by this push:
     new e4474a0  location templates, and clean description
e4474a0 is described below

commit e4474a023ff07c15f6856116873cbf509ff89c49
Author: oleh_mykolaishyn <[email protected]>
AuthorDate: Fri Mar 4 10:44:09 2022 +0200

    location templates, and clean description
---
 .../src/edge/templates/locations/jupyter-gpu.conf  | 29 ++++++++++++++++++++
 .../general/files/gcp/jupyter-gpu_description.json | 18 ------------
 .../general/scripts/gcp/jupyter-gpu_configure.py   | 32 ++++++++++++----------
 .../project/templates/locations/jupyter-gpu.conf   | 29 ++++++++++++++++++++
 4 files changed, 75 insertions(+), 33 deletions(-)

diff --git 
a/infrastructure-provisioning/src/edge/templates/locations/jupyter-gpu.conf 
b/infrastructure-provisioning/src/edge/templates/locations/jupyter-gpu.conf
new file mode 100644
index 0000000..56f98ed
--- /dev/null
+++ b/infrastructure-provisioning/src/edge/templates/locations/jupyter-gpu.conf
@@ -0,0 +1,29 @@
+# *****************************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# 
******************************************************************************
+location ~* /{{ NAME }}/.* {
+    proxy_pass http://{{ IP }}:8888;
+    proxy_set_header Host $http_host;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_set_header X-Real-IP $remote_addr;
+    proxy_http_version 1.1;
+    proxy_set_header Upgrade $http_upgrade;
+    proxy_set_header Connection "upgrade";
+}
diff --git 
a/infrastructure-provisioning/src/general/files/gcp/jupyter-gpu_description.json
 
b/infrastructure-provisioning/src/general/files/gcp/jupyter-gpu_description.json
index 3d5f9ae..d36322c 100644
--- 
a/infrastructure-provisioning/src/general/files/gcp/jupyter-gpu_description.json
+++ 
b/infrastructure-provisioning/src/general/files/gcp/jupyter-gpu_description.json
@@ -3,24 +3,6 @@
   {
     "GPU optimized" : [
       {"Size": "S", "Description": "a2-highgpu-1g", "Type": 
"a2-highgpu-1g","Ram": "85 GB","Cpu": "12"}
-    ],
-    "For testing" : [
-      {"Size": "S", "Description": "n1-standard-2", "Type": 
"n1-standard-2","Ram": "7.50 GB","Cpu": "2"}
-    ],
-    "Memory optimized" : [
-      {"Size": "S", "Description": "n1-highmem-4", "Type": 
"n1-highmem-4","Ram": "26 GB","Cpu": "4"},
-      {"Size": "M", "Description": "n1-highmem-16", "Type": 
"n1-highmem-16","Ram": "104 GB","Cpu": "16"},
-      {"Size": "L", "Description": "n1-highmem-32", "Type": 
"n1-highmem-32","Ram": "208 GB","Cpu": "32"}
-    ],
-    "GPU not optimized": [
-      {"Size": "S", "Description": "n1-standard-2", "Type": 
"n1-standard-2","Ram": "7.50 GB","Cpu": "2"},
-      {"Size": "M", "Description": "n1-highcpu-8", "Type": 
"n1-highcpu-8","Ram": "7.20 GB","Cpu": "8"},
-      {"Size": "L", "Description": "n1-highmem-32", "Type": 
"n1-highmem-32","Ram": "208 GB","Cpu": "32"}
-    ],
-    "Compute optimized": [
-      {"Size": "S", "Description": "n1-highcpu-2", "Type": 
"n1-highcpu-2","Ram": "1.80 GB","Cpu": "2"},
-      {"Size": "M", "Description": "n1-highcpu-8", "Type": 
"n1-highcpu-8","Ram": "7.20 GB","Cpu": "8"},
-      {"Size": "L", "Description": "n1-highcpu-32", "Type": 
"n1-highcpu-32","Ram": "28.8 GB","Cpu": "32"}
     ]
   },
   "exploratory_environment_versions" :
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/jupyter-gpu_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/jupyter-gpu_configure.py
index 885d7a2..2f1c6f1 100644
--- 
a/infrastructure-provisioning/src/general/scripts/gcp/jupyter-gpu_configure.py
+++ 
b/infrastructure-provisioning/src/general/scripts/gcp/jupyter-gpu_configure.py
@@ -206,6 +206,23 @@ if __name__ == "__main__":
         GCPActions.remove_instance(notebook_config['instance_name'], 
notebook_config['zone'])
         sys.exit(1)
 
+    # installing gpu
+    try:
+        logging.info('[INSTALLING GPU DRIVERS]')
+        params = "--hostname {} --keyfile {} --os_user {}".format(
+            instance_hostname, notebook_config['ssh_key_path'], 
notebook_config['datalab_ssh_user'])
+        try:
+            subprocess.run("~/scripts/{}.py {}".format('common_install_gpu', 
params), shell=True, check=True)
+        except:
+            datalab.fab.append_result("Failed installing gpu drivers")
+            raise Exception
+
+    except Exception as err:
+        datalab.fab.append_result("Failed to install GPU drivers.", str(err))
+        GCPActions.remove_instance(notebook_config['instance_name'], 
notebook_config['zone'])
+        sys.exit(1)
+
+
     if notebook_config['image_enabled'] == 'true':
         try:
             logging.info('[CREATING IMAGE]')
@@ -230,21 +247,6 @@ if __name__ == "__main__":
             
GCPActions.remove_image(notebook_config['expected_secondary_image_name'])
             sys.exit(1)
 
-    if os.environ['gpu_enabled'] == 'True':
-        try:
-            logging.info('[INSTALLING GPU DRIVERS]')
-            params = "--hostname {} --keyfile {} --os_user {}".format(
-                instance_hostname, notebook_config['ssh_key_path'], 
notebook_config['datalab_ssh_user'])
-            try:
-                subprocess.run("~/scripts/{}.py 
{}".format('common_install_gpu', params), shell=True, check=True)
-            except:
-                datalab.fab.append_result("Failed installing gpu drivers")
-                raise Exception
-
-        except Exception as err:
-            datalab.fab.append_result("Failed to install GPU drivers.", 
str(err))
-            GCPActions.remove_instance(notebook_config['instance_name'], 
notebook_config['zone'])
-            sys.exit(1)
 
     try:
         logging.info('[SETUP EDGE REVERSE PROXY TEMPLATE]')
diff --git 
a/infrastructure-provisioning/src/project/templates/locations/jupyter-gpu.conf 
b/infrastructure-provisioning/src/project/templates/locations/jupyter-gpu.conf
new file mode 100644
index 0000000..56f98ed
--- /dev/null
+++ 
b/infrastructure-provisioning/src/project/templates/locations/jupyter-gpu.conf
@@ -0,0 +1,29 @@
+# *****************************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# 
******************************************************************************
+location ~* /{{ NAME }}/.* {
+    proxy_pass http://{{ IP }}:8888;
+    proxy_set_header Host $http_host;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_set_header X-Real-IP $remote_addr;
+    proxy_http_version 1.1;
+    proxy_set_header Upgrade $http_upgrade;
+    proxy_set_header Connection "upgrade";
+}

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to