Skip to content

Commit d434dcf

Browse files
doupachewilfred-s
authored andcommitted
[YUNIKORN-2947] enable selection of any partitioned queue in yunikorn cluster (apache#216)
Closes: apache#216 Signed-off-by: Wilfred Spiegelenburg <wilfreds@apache.org>
1 parent ded04cc commit d434dcf

File tree

4 files changed

+74
-19
lines changed

4 files changed

+74
-19
lines changed

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { ApiErrorInterceptor } from '@app/interceptors/api-error/api-error.inter
4747
import { AppComponent } from '@app/app.component';
4848
import { DashboardComponent } from '@app/components/dashboard/dashboard.component';
4949
import { QueuesViewComponent } from '@app/components/queues-view/queues-view.component';
50+
import { QueueV2Component } from '@app/components/queue-v2/queues-v2.component';
5051
import { DonutChartComponent } from '@app/components/donut-chart/donut-chart.component';
5152
import { AreaChartComponent } from '@app/components/area-chart/area-chart.component';
5253
import { AppStatusComponent } from '@app/components/app-status/app-status.component';
@@ -70,6 +71,7 @@ import { CardComponent } from './components/card/card.component';
7071
AppComponent,
7172
DashboardComponent,
7273
QueuesViewComponent,
74+
QueueV2Component,
7375
DonutChartComponent,
7476
AreaChartComponent,
7577
AppStatusComponent,

src/app/components/queue-v2/queues-v2.component.html

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,28 @@
2121
<div class="header">
2222
<div class="title-group">
2323
<div>Partition</div>
24-
<button id="ortButton" class="ort-button">
25-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6">
26-
<path d="M21 12c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.39 0 4.68-0.94 6.36-2.62l-1.41-1.41C15.54 18.37 13.85 19 12 19c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7h-3l4 4 4-4h-3z" />
27-
</svg>
28-
<span class="tooltip" role="tooltip">rotate </span>
29-
</button>
30-
<button id="fitButton" class="fit-to-screen-button">
31-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6">
32-
<path d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
33-
</svg>
34-
<span id="tooltip" class="tooltip" role="tooltip">fit to screen</span>
35-
</button>
24+
<mat-form-field clss="partitionSelect">
25+
<mat-select
26+
[(value)]="partitionSelected"
27+
(selectionChange)="onPartitionSelectionChanged($event)"
28+
>
29+
<mat-option *ngFor="let part of partitionList" [value]="part.value">
30+
{{ part.name }}
31+
</mat-option>
32+
</mat-select>
33+
</mat-form-field>
34+
<button id="ortButton" class="ort-button">
35+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6">
36+
<path d="M21 12c0-4.97-4.03-9-9-9s-9 4.03-9 9 4.03 9 9 9c2.39 0 4.68-0.94 6.36-2.62l-1.41-1.41C15.54 18.37 13.85 19 12 19c-3.86 0-7-3.14-7-7s3.14-7 7-7 7 3.14 7 7h-3l4 4 4-4h-3z" />
37+
</svg>
38+
<span class="tooltip" role="tooltip">rotate </span>
39+
</button>
40+
<button id="fitButton" class="fit-to-screen-button">
41+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6">
42+
<path d="m2.25 12 8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25" />
43+
</svg>
44+
<span id="tooltip" class="tooltip" role="tooltip">fit to screen</span>
45+
</button>
3646
</div>
3747
</div>
3848
<div class="body">

src/app/components/queue-v2/queues-v2.component.scss

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,24 @@
3535
.header .title-group {
3636
display: flex;
3737
align-items: center;
38-
justify-content: space-between;
38+
justify-content: flex-start;
3939
padding-bottom: 1rem;
4040
}
4141

4242
.title-group div {
43-
flex-grow: 1;
44-
text-align: center;
43+
flex-grow: 0;
44+
text-align: left;
4545
font-size: 1.25rem;
4646
font-weight: 600;
4747
color: #010407;
48+
margin-right: 1rem;
4849
}
4950

51+
.title-group mat-form-field {
52+
margin-top: 20px;
53+
margin-right: auto;
54+
}
55+
5056
.fit-to-screen-button {
5157
position: relative;
5258
display: inline-flex;

src/app/components/queue-v2/queues-v2.component.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ import { Component, OnInit} from '@angular/core';
2020
import { Router } from '@angular/router';
2121
import { NgxSpinnerService } from 'ngx-spinner';
2222
import { QueueInfo } from '@app/models/queue-info.model';
23+
import { PartitionInfo } from '@app/models/partition-info.model';
2324
import { finalize } from 'rxjs/operators';
2425
import { SchedulerService } from '@app/services/scheduler/scheduler.service';
26+
import { MatSelectChange } from '@angular/material/select';
27+
2528

2629
import { select, Selection } from "d3-selection";
2730
import * as d3hierarchy from "d3-hierarchy";
@@ -45,6 +48,8 @@ export interface TreeNode {
4548
export class QueueV2Component implements OnInit {
4649
rootQueue: QueueInfo | null = null;
4750
seletedInfo: QueueInfo | null = null;
51+
partitionSelected = '';
52+
partitionList: PartitionInfo[] = [];
4853
resourceValueFormatter = CommonUtil.queueResourceColumnFormatter;
4954
memoryValueFormatter = CommonUtil.absoluteUsedMemoryColumnFormatter;
5055
cpuValueFormatter = CommonUtil.absoluteUsedCPUColumnFormatter;
@@ -56,13 +61,35 @@ export class QueueV2Component implements OnInit {
5661
) {}
5762

5863
ngOnInit() {
59-
this.fetchSchedulerQueuesForPartition()
64+
this.scheduler
65+
.fetchPartitionList()
66+
.pipe(
67+
finalize(() => {
68+
this.spinner.hide();
69+
})
70+
)
71+
.subscribe((list) => {
72+
if (list && list.length > 0) {
73+
list.forEach((part) => {
74+
this.partitionList.push(new PartitionInfo(part.name, part.name));
75+
});
76+
77+
this.partitionSelected = CommonUtil.getStoredPartition(list[0].name);
78+
79+
this.fetchSchedulerQueuesForPartition(this.partitionSelected);
80+
} else {
81+
this.partitionList = [new PartitionInfo('-- Select --', '')];
82+
this.partitionSelected = '';
83+
CommonUtil.setStoredQueueAndPartition('');
84+
}
85+
});
6086
}
6187

62-
fetchSchedulerQueuesForPartition() {
63-
let partitionName = 'default';
88+
fetchSchedulerQueuesForPartition(partitionName: string = '') {
6489
this.spinner.show();
6590

91+
select('.visualize-area').selectAll('*').remove();
92+
6693
this.scheduler
6794
.fetchSchedulerQueues(partitionName)
6895
.pipe(
@@ -85,13 +112,23 @@ export class QueueV2Component implements OnInit {
85112
}
86113

87114
showQueueStats(status: string | undefined) {
88-
console.log('sssss', status)
89115
if(status !== 'Active'){
90116
return '[Inactive]';
91117
} else{
92118
return null;
93119
}
94120
}
121+
122+
onPartitionSelectionChanged(selected: MatSelectChange) {
123+
if (selected.value !== '') {
124+
this.partitionSelected = selected.value;
125+
this.fetchSchedulerQueuesForPartition(this.partitionSelected);
126+
CommonUtil.setStoredQueueAndPartition(this.partitionSelected);
127+
} else {
128+
this.partitionSelected = '';
129+
CommonUtil.setStoredQueueAndPartition('');
130+
}
131+
}
95132
}
96133

97134
function queueVisualization(rawData : QueueInfo , componentInstance: QueueV2Component){

0 commit comments

Comments
 (0)