You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by my...@apache.org on 2021/04/13 10:07:52 UTC

[incubator-datalab] branch DATALAB-2351 updated: [DataLab-2351] - [GCP] Retrieving the list of available GPU updated

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

mykolabodnar pushed a commit to branch DATALAB-2351
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2351 by this push:
     new d14bbad  [DataLab-2351] - [GCP] Retrieving the list of available GPU updated
d14bbad is described below

commit d14bbad6b3bb9da9ad56affea1ada3e1f27a0595
Author: bodnarmykola <bo...@gmail.com>
AuthorDate: Tue Apr 13 13:07:25 2021 +0300

    [DataLab-2351] - [GCP] Retrieving the list of available GPU updated
---
 infrastructure-provisioning/src/general/lib/gcp/meta_lib.py    |  8 +++++++-
 .../src/general/scripts/gcp/edge_configure.py                  | 10 ++++++++++
 .../src/general/scripts/gcp/ssn_configure.py                   | 10 ----------
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
index 8bae9a3..046d92e 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
@@ -585,9 +585,15 @@ class GCPMeta:
     def get_list_gpu_types(self, zone):
         try:
             print('Getting available GPU types')
+            data = []
             request = self.service.acceleratorTypes().list(project=self.project, zone=zone)
             result = request.execute().get('items')
-            return result
+            for id in result:
+                gpu_accelerator_type = id.get('name')
+                if not re.search("vws", gpu_accelerator_type):
+                    data.append(gpu_accelerator_type)
+            return data
+            return data
         except Exception as err:
             logging.info("Error with getting list of GPU types: " + str(err) + "\n Traceback: " + traceback.print_exc(
                 file=sys.stdout))
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/edge_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/edge_configure.py
index f8d1266..7507d59 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/edge_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/edge_configure.py
@@ -290,6 +290,14 @@ if __name__ == "__main__":
         sys.exit(1)
 
     try:
+        logging.info('[GET AVAILABLE GPU TYPES]')
+        edge_conf['gpu_types'] = GCPMeta.get_list_gpu_types(edge_conf['zone'])
+    except Exception as err:
+        datalab.fab.datalab.fab.append_result("Unable to get available GPU types.", str(err))
+        clear_resources()
+        sys.exit(1)
+
+    try:
         print('[SUMMARY]')
         logging.info('[SUMMARY]')
         print("Instance name: {}".format(edge_conf['instance_name']))
@@ -300,6 +308,7 @@ if __name__ == "__main__":
         print("Bucket name: {}".format(edge_conf['bucket_name']))
         print("Shared bucket name: {}".format(edge_conf['shared_bucket_name']))
         print("Notebook subnet: {}".format(edge_conf['private_subnet_cidr']))
+        print("Available GPU types: {}".format(edge_conf['gpu_types']))
         with open("/root/result.json", 'w') as result:
             res = {"hostname": edge_conf['instance_hostname'],
                    "public_ip": edge_conf['static_ip'],
@@ -313,6 +322,7 @@ if __name__ == "__main__":
                    "notebook_subnet": edge_conf['private_subnet_cidr'],
                    "full_edge_conf": edge_conf,
                    "project_name": edge_conf['project_name'],
+                   "gpu_types": edge_conf['gpu_types'],
                    "@class": "com.epam.datalab.dto.gcp.edge.EdgeInfoGcp",
                    "Action": "Create new EDGE server"}
             print(json.dumps(res))
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
index 1dcbbca..6282be4 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
@@ -526,14 +526,6 @@ if __name__ == "__main__":
         sys.exit(1)
 
     try:
-        logging.info('[GET AVAILABLE GPU TYPES]')
-        ssn_conf['gpu_types'] = GCPMeta.get_list_gpu_types(ssn_conf['zone'])
-    except Exception as err:
-        datalab.fab.datalab.fab.append_result("Unable to get available GPU types.", str(err))
-        clear_resources()
-        sys.exit(1)
-
-    try:
         logging.info('[SUMMARY]')
         print('[SUMMARY]')
         print("Service base name: {}".format(ssn_conf['service_base_name']))
@@ -547,7 +539,6 @@ if __name__ == "__main__":
         print("SSN instance size: {}".format(ssn_conf['instance_size']))
         print("SSN AMI name: {}".format(ssn_conf['image_name']))
         print("Region: {}".format(ssn_conf['region']))
-        print("Available GPU types: {}".format(ssn_conf['gpu_types']))
         jenkins_url = "http://{}/jenkins".format(ssn_conf['instance_hostname'])
         jenkins_url_https = "https://{}/jenkins".format(ssn_conf['instance_hostname'])
         print("Jenkins URL: {}".format(jenkins_url))
@@ -571,7 +562,6 @@ if __name__ == "__main__":
                    "security_id": ssn_conf['firewall_name'],
                    "instance_shape": ssn_conf['instance_size'],
                    "region": ssn_conf['region'],
-                   "gpu_types": ssn_conf['gpu_types'],
                    "action": "Create SSN instance"}
             f.write(json.dumps(res))
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org