Skip to content

Commit

Permalink
Add worker parameter for GC (#18882)
Browse files Browse the repository at this point in the history
1. Related back-end PR #18855

Signed-off-by: AllForNothing <sshijun@vmware.com>
  • Loading branch information
AllForNothing authored Jul 4, 2023
1 parent ef96c72 commit 1d2624e
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export const YES: string = 'TAG_RETENTION.YES';
export const NO: string = 'TAG_RETENTION.NO';

export const REFRESH_STATUS_TIME_DIFFERENCE: number = 5000;

export const WORKER_OPTIONS: number[] = [1, 2, 3, 4, 5];
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,37 @@
[originCron]="originCron"
(inputvalue)="saveGcSchedule($event)"></cron-selection>
</div>
<div class="clr-row mb-1">
<div class="clr-col-2 flex-200 font-style">
{{ 'JOB_SERVICE_DASHBOARD.WORKERS' | translate
}}<clr-tooltip>
<clr-icon
clrTooltipTrigger
shape="info-circle"
size="24"></clr-icon>
<clr-tooltip-content
clrPosition="top-right"
clrSize="lg"
*clrIfOpen>
<span>{{ 'GC.WORKERS_TOOLTIP' | translate }}</span>
</clr-tooltip-content>
</clr-tooltip>
</div>
<div class="clr-col">
<div class="clr-select-wrapper">
<select
id="workers"
class="clr-select worker-select"
[(ngModel)]="workerNum">
<option
*ngFor="let item of workerOptions"
value="{{ item }}">
{{ item }}
</option>
</select>
</div>
</div>
</div>
<div class="clr-row">
<div class="clr-col-2 flex-200"></div>
<div class="clr-col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@
padding-left: .6rem;
padding-right: .6rem;
}

.worker-select {
width: 4.5rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { GcHistoryComponent } from './gc-history/gc-history.component';
import {
JOB_STATUS,
REFRESH_STATUS_TIME_DIFFERENCE,
WORKER_OPTIONS,
} from '../../clearing-job-interfact';
import { clone } from '../../../../../shared/units/utils';

const ONE_MINUTE = 60000;

Expand All @@ -27,6 +29,8 @@ export class GcComponent implements OnInit, OnDestroy {
@ViewChild(CronScheduleComponent)
cronScheduleComponent: CronScheduleComponent;
shouldDeleteUntagged: boolean;
workerNum: number = 1;
workerOptions: number[] = clone(WORKER_OPTIONS);
dryRunOnGoing: boolean = false;

lastCompletedTime: string;
Expand Down Expand Up @@ -116,8 +120,10 @@ export class GcComponent implements OnInit, OnDestroy {
this.shouldDeleteUntagged = JSON.parse(
gcHistory.job_parameters
).delete_untagged;
this.workerNum = +JSON.parse(gcHistory.job_parameters).workers;
} else {
this.shouldDeleteUntagged = false;
this.workerNum = 1;
}
}

Expand All @@ -132,6 +138,7 @@ export class GcComponent implements OnInit, OnDestroy {
schedule: {
parameters: {
delete_untagged: this.shouldDeleteUntagged,
workers: +this.workerNum,
dry_run: false,
},
schedule: {
Expand All @@ -157,6 +164,7 @@ export class GcComponent implements OnInit, OnDestroy {
schedule: {
parameters: {
delete_untagged: this.shouldDeleteUntagged,
workers: +this.workerNum,
dry_run: true,
},
schedule: {
Expand Down Expand Up @@ -188,6 +196,7 @@ export class GcComponent implements OnInit, OnDestroy {
schedule: {
parameters: {
delete_untagged: this.shouldDeleteUntagged,
workers: +this.workerNum,
dry_run: false,
},
schedule: {
Expand All @@ -212,6 +221,7 @@ export class GcComponent implements OnInit, OnDestroy {
schedule: {
parameters: {
delete_untagged: this.shouldDeleteUntagged,
workers: +this.workerNum,
dry_run: false,
},
schedule: {
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/de-de-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Artefakt erfolgreich kopiert",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/en-us-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Copy artifact successfully",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/es-es-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Copy artifact successfully",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/fr-fr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Artefact copié",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/pt-br-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Artefato copiado com sucesso",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/tr-tr-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Copy artifact successfully",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/zh-cn-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}}个 blob(s) 和 {{manifest}}个 manifest(s) 已删除",
"DELETE_BLOB": "{{blob}}个 blob(s) 已删除",
"DELETE_MANIFEST": "{{manifest}}个 manifest(s) 已删除",
"FREE_UP_SIZE": "{{size}}的空间已清理"
"FREE_UP_SIZE": "{{size}}的空间已清理",
"WORKERS_TOOLTIP": "设置可并行执行垃圾回收任务的工作者数量,默认值为1。"
},
"RETAG": {
"MSG_SUCCESS": "Artifact 拷贝成功",
Expand Down
3 changes: 2 additions & 1 deletion src/portal/src/i18n/lang/zh-tw-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,8 @@
"DELETE_BLOB_AND_MANIFEST": "{{blob}} blob(s) and {{manifest}} manifest(s) deleted",
"DELETE_BLOB": "{{blob}} blob(s) deleted",
"DELETE_MANIFEST": "{{manifest}} manifest(s) deleted",
"FREE_UP_SIZE": "{{size}} space freed up"
"FREE_UP_SIZE": "{{size}} space freed up",
"WORKERS_TOOLTIP": "Set the number of workers that can execute GC tasks in parallel, the default value is 1."
},
"RETAG": {
"MSG_SUCCESS": "Artifact 複製成功",
Expand Down

0 comments on commit 1d2624e

Please sign in to comment.