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/12 08:57:57 UTC
[incubator-datalab] 01/01: [DataLab-2351] - [GCP] Retrieved the
list of available GPU
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
commit 39b898b9ae7207a760aebb8418ef3cc32624bee7
Author: bodnarmykola <bo...@gmail.com>
AuthorDate: Mon Apr 12 11:57:31 2021 +0300
[DataLab-2351] - [GCP] Retrieved the list of available GPU
---
.../src/general/lib/gcp/meta_lib.py | 14 ++++++++++++++
.../src/general/scripts/gcp/ssn_configure.py | 10 ++++++++++
2 files changed, 24 insertions(+)
diff --git a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
index e0596cc..8bae9a3 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
@@ -582,6 +582,20 @@ class GCPMeta:
traceback.print_exc(file=sys.stdout)
return ''
+ def get_list_gpu_types(self, zone):
+ try:
+ print('Getting available GPU types')
+ request = self.service.acceleratorTypes().list(project=self.project, zone=zone)
+ result = request.execute().get('items')
+ return result
+ except Exception as err:
+ logging.info("Error with getting list of GPU types: " + str(err) + "\n Traceback: " + traceback.print_exc(
+ file=sys.stdout))
+ append_result(str({"error": "Error with getting list of GPU types",
+ "error_message": str(err) + "\n Traceback: " + traceback.print_exc(file=sys.stdout)}))
+ traceback.print_exc(file=sys.stdout)
+ return ''
+
def get_list_static_addresses(self, region, filter_string=''):
try:
if not filter_string:
diff --git a/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
index 6282be4..ccfed3c 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/ssn_configure.py
@@ -526,6 +526,14 @@ 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']))
@@ -539,6 +547,7 @@ 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))
@@ -562,6 +571,7 @@ 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