You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/06/09 10:44:10 UTC

[incubator-dlab] branch DLAB-1737 updated: [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa

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

dgnatyshyn pushed a commit to branch DLAB-1737
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1737 by this push:
     new 477b716  [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa
477b716 is described below

commit 477b716dd99ff0f6ff25d607e69a8e4cb9a86128
Author: Dmytro_Gnatyshyn <di...@ukr.net>
AuthorDate: Tue Jun 9 13:43:27 2020 +0300

    [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa
---
 ...computational-resource-create-dialog.component.ts | 13 +------------
 .../create-environment.component.ts                  | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
index 39951e4..ab252f0 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
@@ -76,7 +76,6 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
   ngOnInit() {
     this.loading = true;
     this.notebook_instance = this.data.notebook;
-    console.log(this.data.notebook);
     this.resourcesList = this.data.full_list;
     this.initFormModel();
     this.getTemplates(this.notebook_instance.project, this.notebook_instance.endpoint, this.notebook_instance.cloud_provider);
@@ -84,7 +83,6 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
 
   public selectImage($event) {
     this.selectedImage = $event;
-    console.log( this.selectedImage);
     this.filterShapes();
     this.getComputationalResourceLimits();
 
@@ -271,9 +269,6 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
     const allowed: any = ['GPU optimized'];
     if (this.notebook_instance.template_name.toLowerCase().indexOf('tensorflow') !== -1
       || this.notebook_instance.template_name.toLowerCase().indexOf('deep learning') !== -1
-      || this.notebook_instance.shape === 'n1-standard-2'
-      || this.notebook_instance.shape === 'n1-highcpu-8'
-      || this.notebook_instance.shape === 'n1-highmem-32'
     ) {
       const filtered = Object.keys(
         SortUtils.shapesSort(this.selectedImage.computation_resources_shapes))
@@ -282,16 +277,13 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
           obj[key] = this.selectedImage.computation_resources_shapes[key];
           return obj;
         }, {});
-      console.log('Only GPU');
       if (this.PROVIDER !== 'azure') {
         const images = this.clusterTypes.filter(image => image.image === 'docker.dlab-dataengine');
         this.clusterTypes = images;
         this.selectedImage = this.clusterTypes[0];
       }
       this.selectedImage.computation_resources_shapes = filtered;
-    } else if (this.notebook_instance.shape !== 'n1-standard-2'
-      && this.notebook_instance.shape !== 'n1-highcpu-8'
-      && this.notebook_instance.shape !== 'n1-highmem-32') {
+    } else {
       const filtered = Object.keys(
         SortUtils.shapesSort(this.selectedImage.computation_resources_shapes))
         .filter(key => !(allowed.includes(key)))
@@ -300,9 +292,6 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
           return obj;
         }, {});
       this.selectedImage.computation_resources_shapes = filtered;
-      console.log('Bez GPU');
-    }else{
-      console.log('On GPU');
     }
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
index d23d7a4..4ae38ad 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
@@ -111,8 +111,24 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
 
   public getShapes(template) {
     this.currentTemplate = template;
-    this.shapes = SortUtils.shapesSort(template.exploratory_environment_shapes);
-    this.getImagesList();
+    const allowed: any = ['GPU optimized'];
+    if (template.exploratory_environment_versions[0].template_name.toLowerCase().indexOf('tensorflow') === -1
+      && template.exploratory_environment_versions[0].template_name.toLowerCase().indexOf('deep learning') === -1
+    ) {
+      const filtered = Object.keys(
+        SortUtils.shapesSort(template.exploratory_environment_shapes))
+        .filter(key => !(allowed.includes(key)))
+        .reduce((obj, key) => {
+          obj[key] = template.exploratory_environment_shapes[key];
+          return obj;
+        }, {});
+      template.exploratory_environment_shapes.computation_resources_shapes = filtered;
+      this.shapes = SortUtils.shapesSort(template.exploratory_environment_shapes.computation_resources_shapes);
+      this.getImagesList();
+    } else {
+      this.shapes = SortUtils.shapesSort(template.exploratory_environment_shapes);
+      this.getImagesList();
+    }
   }
 
   public createExploratoryEnvironment(data) {


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