You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by ol...@apache.org on 2022/03/25 12:55:59 UTC
[incubator-datalab] branch 2.5.1-tcpc-compute-shapes updated: filtered compute
This is an automated email from the ASF dual-hosted git repository.
olehmykolaishyn pushed a commit to branch 2.5.1-tcpc-compute-shapes
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/2.5.1-tcpc-compute-shapes by this push:
new db2ebdd filtered compute
db2ebdd is described below
commit db2ebdd5c336ce7dfd870972fe0366d1dc19294a
Author: oleh_mykolaishyn <ow...@gmail.com>
AuthorDate: Fri Mar 25 14:54:42 2022 +0200
filtered compute
---
...mputational-resource-create-dialog.component.ts | 35 +++++++++++++++++++---
1 file changed, 31 insertions(+), 4 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 6fd9991..e7334d5 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
@@ -20,6 +20,7 @@
import { Component, OnInit, Inject, ChangeDetectorRef } from '@angular/core';
import {FormGroup, FormBuilder, Validators} from '@angular/forms';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
+import { tap } from 'rxjs/operators';
import { ToastrService } from 'ngx-toastr';
import { ComputationalResourceModel } from './computational-resource-create.model';
@@ -145,7 +146,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
.subscribe(
(response: any) => {
if (response.status === HTTP_STATUS_CODES.OK) this.dialogRef.close(true);
- },
+ },
error => this.toastr.error(error.message, 'Oops!')
);
}
@@ -249,7 +250,7 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
private validConfiguration(control) {
if (this.isSelected.configuration) {
- return this.isSelected.configuration
+ return this.isSelected.configuration
? (control.value && control.value !== null && CheckUtils.isJSON(control.value) ? null : { valid: false })
: null;
}
@@ -266,15 +267,23 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
}
private getTemplates(project, endpoint, provider) {
- this.userResourceService.getComputationalTemplates(project, endpoint, provider).subscribe(
+ this.userResourceService.getComputationalTemplates(project, endpoint, provider)
+ .pipe(
+ tap(responce => {
+ const templateList = responce.templates;
+ this.checkTemplateList(templateList);
+ })
+ )
+ .subscribe(
clusterTypes => {
this.clusterTypes = clusterTypes.templates;
this.userComputations = clusterTypes.user_computations;
this.projectComputations = clusterTypes.project_computations;
this.clusterTypes.forEach((cluster, index) => this.clusterTypes[index].computation_resources_shapes =
- SortUtils.shapesSort(cluster.computation_resources_shapes));
+ SortUtils.shapesSort(cluster.computation_resources_shapes));
this.selectedImage = this.clusterTypes[0];
+
if (this.selectedImage) {
this._ref.detectChanges();
this.filterShapes();
@@ -331,6 +340,24 @@ export class ComputationalResourceCreateDialogComponent implements OnInit {
return filtered;
}
+ private checkTemplateList(templates) {
+ templates.forEach(template => {
+ if(template.image === 'docker.datalab-tensor-jupyterlab') {
+ this.filterShapeList(template.computation_resources_shapes)
+ }
+ });
+ }
+
+ private filterShapeList(shapeList) {
+ Object.keys(shapeList).forEach(shape => {
+ shapeList[shape] = shapeList[shape].filter(
+ shape => {
+ return shape.Type === 'r3.xlarge' || shape.Type ==='c4.large';
+ })
+ })
+
+ }
+
private containsComputationalResource(conputational_resource_name: string, existNames: Array<string>): boolean {
if (conputational_resource_name) {
return existNames.some(resource =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org