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

commit 9696092dd4775b9a87980906425df0ffbb429fe3
Author: Dmytro_Gnatyshyn <[email protected]>
AuthorDate: Wed Jun 3 16:46:23 2020 +0300

    [DLAB-1737]: Allowed for notebook based on GPU allow only GPU computational 
resource and vice-versa
---
 ...mputational-resource-create-dialog.component.ts | 29 ++++++++++++++++++----
 1 file changed, 24 insertions(+), 5 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 414f483..39951e4 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,6 +76,7 @@ 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);
@@ -83,6 +84,8 @@ export class ComputationalResourceCreateDialogComponent 
implements OnInit {
 
   public selectImage($event) {
     this.selectedImage = $event;
+    console.log( this.selectedImage);
+    this.filterShapes();
     this.getComputationalResourceLimits();
 
     if ($event.templates && $event.templates.length)
@@ -253,10 +256,8 @@ export class ComputationalResourceCreateDialogComponent 
implements OnInit {
         this.clusterTypes.forEach((cluster, index) => 
this.clusterTypes[index].computation_resources_shapes =
           SortUtils.shapesSort(cluster.computation_resources_shapes));
         this.selectedImage = clusterTypes.templates[0];
-
         if (this.selectedImage) {
           this._ref.detectChanges();
-
           this.filterShapes();
           
this.resourceForm.get('template_name').setValue(this.selectedImage.template_name);
           this.getComputationalResourceLimits();
@@ -267,9 +268,13 @@ export class ComputationalResourceCreateDialogComponent 
implements OnInit {
   }
 
   private filterShapes(): void {
+    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) {
-      const allowed: any = ['GPU optimized'];
+      || 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))
         .filter(key => allowed.includes(key))
@@ -277,13 +282,27 @@ 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') {
+      const filtered = Object.keys(
+        SortUtils.shapesSort(this.selectedImage.computation_resources_shapes))
+        .filter(key => !(allowed.includes(key)))
+        .reduce((obj, key) => {
+          obj[key] = this.selectedImage.computation_resources_shapes[key];
+          return obj;
+        }, {});
+      this.selectedImage.computation_resources_shapes = filtered;
+      console.log('Bez GPU');
+    }else{
+      console.log('On GPU');
     }
   }
 


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

Reply via email to