This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push: new 8f85f9b [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa (#781) 8f85f9b is described below commit 8f85f9ba2096d58284b06ee91654a38e754b7ce5 Author: Dmytro Gnatyshyn <42860905+dg1...@users.noreply.github.com> AuthorDate: Tue Jun 9 13:46:01 2020 +0300 [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa (#781) [DLAB-1737]: For notebook based on GPU allowed only GPU computational resource and vice-versa --- ...computational-resource-create-dialog.component.ts | 18 +++++++++++++----- .../create-environment.component.ts | 20 ++++++++++++++++++-- 2 files changed, 31 insertions(+), 7 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..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 @@ -83,6 +83,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit { public selectImage($event) { this.selectedImage = $event; + this.filterShapes(); this.getComputationalResourceLimits(); if ($event.templates && $event.templates.length) @@ -253,10 +254,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 +266,10 @@ 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 + ) { const filtered = Object.keys( SortUtils.shapesSort(this.selectedImage.computation_resources_shapes)) .filter(key => allowed.includes(key)) @@ -277,13 +277,21 @@ export class ComputationalResourceCreateDialogComponent implements OnInit { obj[key] = this.selectedImage.computation_resources_shapes[key]; return obj; }, {}); - 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 { + 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; } } 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-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org