You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by yt...@apache.org on 2021/06/15 07:45:42 UTC
[incubator-datalab] 01/01: [DATALAB-1939] showed all resources
which will be terminated
This is an automated email from the ASF dual-hosted git repository.
ytykhun pushed a commit to branch DATALAB-1939
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit 66cc8e2fae88c9ea5a7683987f5fc0ddd4f1d34a
Author: Yurii Tykhun <ty...@gmail.com>
AuthorDate: Tue Jun 15 10:44:54 2021 +0300
[DATALAB-1939] showed all resources which will be terminated
---
.../app/administration/project/project.component.ts | 20 +++++++++++---------
.../create-environment.component.html | 8 ++++----
.../create-environment.component.ts | 20 ++++++++++----------
3 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
index ba60451..2e28831 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.ts
@@ -26,7 +26,7 @@ import { ProjectDataService } from './project-data.service';
import {HealthStatusService, ProjectService, UserResourceService} from '../../core/services';
import { NotificationDialogComponent } from '../../shared/modal-dialog/notification-dialog';
import { ProjectListComponent } from './project-list/project-list.component';
-import {ExploratoryModel} from '../../resources/resources-grid/resources-grid.model';
+import { EnvironmentsDataService } from '../management/management-data.service';
export interface Endpoint {
name: string;
@@ -67,7 +67,7 @@ export class ProjectComponent implements OnInit, OnDestroy {
private projectService: ProjectService,
private projectDataService: ProjectDataService,
private healthStatusService: HealthStatusService,
- private userResourceService: UserResourceService
+ private environmentsDataService: EnvironmentsDataService
) { }
ngOnInit() {
@@ -85,10 +85,9 @@ export class ProjectComponent implements OnInit, OnDestroy {
}
private getResources() {
- this.userResourceService.getUserProvisionedResources()
- .subscribe((result: any) => {
- this.resources = ExploratoryModel.loadEnvironments(result);
- });
+ this.environmentsDataService.getEnvironmentDataDirect().subscribe((data: any) => {
+ this.resources = data;
+ });
}
refreshGrid() {
@@ -125,13 +124,16 @@ export class ProjectComponent implements OnInit, OnDestroy {
private toggleStatusRequest(data, action, isOnlyOneEdge?) {
if ( action === 'terminate') {
- const projectsResources = this.resources.filter(resource => resource.project === data.project_name);
- const activeProjectsResources = projectsResources.length ? projectsResources[0].exploratory
+ const projectsResources = this.resources
+ .filter(resource => resource.project === data.project_name && resource.resource_type !== "edge node");
+
+ const activeProjectsResources = projectsResources?.length ? projectsResources
.filter(expl => expl.status !== 'terminated' && expl.status !== 'terminating' && expl.status !== 'failed') : [];
+
const termResources = data.endpoint.reduce((res, endp) => {
res.push(...activeProjectsResources.filter(resource => resource.endpoint === endp));
return res;
- }, []).map(resource => resource.name);
+ }, []).map(resource => resource.resource_name);
if (termResources.length === 0 && !isOnlyOneEdge) {
this.edgeNodeAction(data, action);
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
index b3f280c..56b12c9 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
@@ -223,7 +223,7 @@
<span class="form-field-wrapper" [ngClass]="{ 'not-active': !createExploratoryForm.controls['shape'].value}">
<mat-form-field>
<mat-label>Select GPU type</mat-label>
- <mat-select formControlName="gpuType" disableOptionCentering [disabled]="!createExploratoryForm.controls['shape'].value"
+ <mat-select formControlName="gpu_type" disableOptionCentering [disabled]="!createExploratoryForm.controls['shape'].value"
panelClass="create-resources-dialog" placeholder="GPU type">
<mat-option *ngFor="let list_item of gpuTypes" [value]="list_item" (click)="setCount('', list_item)">
{{ list_item}}
@@ -245,12 +245,12 @@
[matTooltip]="'Please, select GPU type.'"
matTooltipPosition="above"
[matTooltipClass]="'full-size-tooltip'"
- [matTooltipDisabled]="!!createExploratoryForm.controls['gpuType'].value"
+ [matTooltipDisabled]="!!createExploratoryForm.controls['gpu_type'].value"
>
- <span class="form-field-wrapper" [ngClass]="{ 'not-active': !createExploratoryForm.controls['gpuType'].value}">
+ <span class="form-field-wrapper" [ngClass]="{ 'not-active': !createExploratoryForm.controls['gpu_type'].value}">
<mat-form-field>
<mat-label>Select GPU count</mat-label>
- <mat-select formControlName="gpuCount" disableOptionCentering [disabled]="!createExploratoryForm.controls['gpuType'].value"
+ <mat-select formControlName="gpu_count" disableOptionCentering [disabled]="!createExploratoryForm.controls['gpu_type'].value"
panelClass="create-resources-dialog" placeholder="GPU count">
<mat-option *ngFor="let list_item of gpuCount" [value]="list_item">
{{ list_item }}
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 0acb47f..958261a 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
@@ -105,7 +105,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
}
public setEndpoints(project) {
- const controls = ['endpoint', 'version', 'shape', 'gpuType', 'gpuCount'];
+ const controls = ['endpoint', 'version', 'shape', 'gpu_type', 'gpu_count'];
this.resetSelections(controls);
this.endpoints = project.endpoints
@@ -152,11 +152,11 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
public getShapes(template) {
this.selectedImage = null;
- const controls = ['notebook_image_name', 'shape', 'gpuType', 'gpuCount'];
+ const controls = ['notebook_image_name', 'shape', 'gpu_type', 'gpu_count'];
controls.forEach(control => {
this.createExploratoryForm.controls[control].setValue(null);
- if (control === 'gpuType' || control === 'gpuCount') {
+ if (control === 'gpu_type' || control === 'gpu_count') {
this.createExploratoryForm.controls[control].clearValidators();
this.createExploratoryForm.controls[control].updateValueAndValidity();
}
@@ -208,7 +208,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
};
data.cluster_config = data.cluster_config ? JSON.parse(data.cluster_config) : null;
-
+
this.userResourceService.createExploratoryEnvironment({ ...parameters, ...data }).subscribe((response: any) => {
if (response.status === HTTP_STATUS_CODES.OK) this.dialogRef.close();
}, error => this.toastr.error(error.message || 'Exploratory creation failed!', 'Oops!'));
@@ -236,7 +236,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
this.additionalParams.gpu = !this.additionalParams.gpu;
this.createExploratoryForm.controls['gpu_enabled'].setValue(this.additionalParams.gpu);
- const controls = ['gpuType', 'gpuCount'];
+ const controls = ['gpu_type', 'gpu_count'];
if (!this.additionalParams.gpu) {
controls.forEach(control => {
this.createExploratoryForm.controls[control].setValue(null);
@@ -256,7 +256,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
}
public setInstanceSize() {
- const controls = ['gpuType', 'gpuCount'];
+ const controls = ['gpu_type', 'gpu_count'];
controls.forEach(control => {
this.createExploratoryForm.controls[control].setValue(null);
});
@@ -266,8 +266,8 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
if (gpuType && this.currentTemplate.image === 'docker.datalab-deeplearning') {
this.additionalParams.gpu = true;
this.createExploratoryForm.controls['gpu_enabled'].setValue(this.additionalParams.gpu);
- this.createExploratoryForm.controls['gpuCount'].setValidators([Validators.required]);
- this.createExploratoryForm.controls['gpuCount'].updateValueAndValidity();
+ this.createExploratoryForm.controls['gpu_count'].setValidators([Validators.required]);
+ this.createExploratoryForm.controls['gpu_count'].updateValueAndValidity();
}
// if (type === 'master') {
const masterShape = this.createExploratoryForm.controls['shape'].value;
@@ -293,8 +293,8 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit {
]],
cluster_config: ['', [this.validConfiguration.bind(this)]],
custom_tag: ['', [Validators.pattern(PATTERNS.namePattern)]],
- gpuType: [null],
- gpuCount: [null],
+ gpu_type: [null],
+ gpu_count: [null],
gpu_enabled: [false]
});
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org