Skip to content

Commit

Permalink
[FLINK-26206][runtime-web] add service layer abstraction and refactor…
Browse files Browse the repository at this point in the history
… config service
  • Loading branch information
yangjunhan authored and Airblader committed May 12, 2022
1 parent 278f5f9 commit 13ad359
Show file tree
Hide file tree
Showing 84 changed files with 1,078 additions and 664 deletions.
2 changes: 1 addition & 1 deletion flink-runtime-web/web-dashboard/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Component } from '@angular/core';
import { fromEvent, merge } from 'rxjs';
import { map, startWith } from 'rxjs/operators';

import { StatusService } from 'services';
import { StatusService } from '@flink-runtime-web/services';

@Component({
selector: 'flink-root',
Expand Down
3 changes: 1 addition & 2 deletions flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import { Injectable, Injector } from '@angular/core';
import { Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';

import { StatusService } from '@flink-runtime-web/services';
import { NzNotificationService, NzNotificationDataOptions } from 'ng-zorro-antd/notification';

import { StatusService } from 'services';

@Injectable()
export class AppInterceptor implements HttpInterceptor {
constructor(private readonly injector: Injector) {}
Expand Down
5 changes: 2 additions & 3 deletions flink-runtime-web/web-dashboard/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ import {
ShrinkOutline,
PicCenterOutline
} from '@ant-design/icons-angular/icons';
import { Configuration } from '@flink-runtime-web/interfaces';
import { StatusService } from '@flink-runtime-web/services';
import { NzAlertModule } from 'ng-zorro-antd/alert';
import { NzBadgeModule } from 'ng-zorro-antd/badge';
import { NZ_CONFIG, NzConfig } from 'ng-zorro-antd/core/config';
Expand All @@ -73,9 +75,6 @@ import { NzLayoutModule } from 'ng-zorro-antd/layout';
import { NzMenuModule } from 'ng-zorro-antd/menu';
import { NzNotificationModule } from 'ng-zorro-antd/notification';

import { Configuration } from 'interfaces';
import { StatusService } from 'services';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AppInterceptor } from './app.interceptor';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
* limitations under the License.
*/

export interface JobAccumulators {
main: UserAccumulators[];
subtasks: SubTaskAccumulators[];
}

export interface UserAccumulators {
name: string;
type: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export interface Checkpoint {
checkpointed_size: CheckpointMinMaxAvgStatistics;
state_size: CheckpointMinMaxAvgStatistics;
end_to_end_duration: CheckpointMinMaxAvgStatistics;
processed_data: CheckpointMinMaxAvgStatistics;
persisted_data: CheckpointMinMaxAvgStatistics;
alignment_buffered: CheckpointMinMaxAvgStatistics;
};
latest: {
Expand Down
11 changes: 11 additions & 0 deletions flink-runtime-web/web-dashboard/src/app/interfaces/job-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,22 @@
* limitations under the License.
*/

export interface JobManagerConfig {
key: string;
value: string;
}

export interface JobManagerLogItem {
name: string;
size: number;
mtime: number;
}

export interface JobManagerLogDetail {
data: string;
url: string;
}

export interface JobManagerThreadDump {
threadInfos: JobManagerThreadInfo[];
}
Expand Down
36 changes: 36 additions & 0 deletions flink-runtime-web/web-dashboard/src/app/interfaces/job-metrics.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface JobMetric {
id: string;
value: string;
}

export interface MetricMap {
[p: string]: number;
}

export interface MetricMapWithTimestamp {
timestamp: number;
values: MetricMap;
}

export interface Watermarks {
lowWatermark: number;
watermarks: MetricMap;
}
7 changes: 6 additions & 1 deletion flink-runtime-web/web-dashboard/src/app/interfaces/plan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

import { NodesItem } from './job-detail';
import { NodesItem, NodesItemCorrect, VerticesLink } from './job-detail';

export interface Plan {
plan: {
Expand All @@ -25,3 +25,8 @@ export interface Plan {
nodes: NodesItem[];
};
}

export interface PlanDetail {
nodes: NodesItemCorrect[];
links: VerticesLink[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export * from './overview';
export * from './task-manager';
export * from './job-accumulators';
export * from './job-manager';
export * from './job-metrics';
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

export interface TaskManagerList {
taskmanagers: TaskmanagersItem[];
taskmanagers: TaskManagersItem[];
}

export interface TaskManagerDetail {
Expand All @@ -38,7 +38,12 @@ export interface TaskManagerLogItem {
mtime: number;
}

export interface TaskmanagersItem {
export interface TaskManagerLogDetail {
data: string;
url: string;
}

export interface TaskManagersItem {
id: string;
path: string;
dataPort: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';

import { JobManagerService } from 'services';
import { JobManagerService } from '@flink-runtime-web/services';

@Component({
selector: 'flink-job-manager-configuration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { ShareModule } from '@flink-runtime-web/share/share.module';
import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
import { NzCardModule } from 'ng-zorro-antd/card';
import { NzCodeEditorModule } from 'ng-zorro-antd/code-editor';
Expand All @@ -28,7 +29,6 @@ import { NzIconModule } from 'ng-zorro-antd/icon';
import { NzProgressModule } from 'ng-zorro-antd/progress';
import { NzTableModule } from 'ng-zorro-antd/table';
import { NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { ShareModule } from 'share/share.module';

import { JobManagerConfigurationComponent } from './configuration/job-manager-configuration.component';
import { JobManagerRoutingModule } from './job-manager-routing.module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ import { ActivatedRoute } from '@angular/router';
import { Subject } from 'rxjs';
import { finalize, takeUntil } from 'rxjs/operators';

import { JobManagerService } from '@flink-runtime-web/services';
import { flinkEditorOptions } from '@flink-runtime-web/share/common/editor/editor-config';
import { EditorOptions } from 'ng-zorro-antd/code-editor/typings';
import { flinkEditorOptions } from 'share/common/editor/editor-config';

import { JobManagerService } from 'services';

@Component({
selector: 'flink-job-manager-log-detail',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { finalize } from 'rxjs/operators';

import { JobManagerLogItem } from 'interfaces';
import { JobManagerService } from 'services';
import { JobManagerLogItem } from '@flink-runtime-web/interfaces';
import { JobManagerService } from '@flink-runtime-web/services';

import { typeDefinition } from '../../../utils/strong-type';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
*/

import { ChangeDetectorRef, Component, OnInit, ChangeDetectionStrategy, OnDestroy } from '@angular/core';
import { JobManagerService } from 'services';
import { JobManagerService } from '@flink-runtime-web/services';
import { EditorOptions } from 'ng-zorro-antd/code-editor/typings';
import { flinkEditorOptions } from 'share/common/editor/editor-config';
import { flinkEditorOptions } from '@flink-runtime-web/share/common/editor/editor-config';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnIni
import { Subject } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';

import { JobManagerService, StatusService } from 'services';
import { JobManagerService, StatusService } from '@flink-runtime-web/services';

@Component({
selector: 'flink-job-manager-metrics',
Expand Down Expand Up @@ -51,14 +51,14 @@ export class JobManagerMetricsComponent implements OnInit, OnDestroy {
});
this.statusService.refresh$.pipe(takeUntil(this.destroy$)).subscribe(() => {
this.jobManagerService
.getMetricsName()
.loadMetricsName()
.pipe(map(arr => arr.filter(item => item.indexOf('Status.JVM.GarbageCollector') !== -1)))
.subscribe(data => {
this.listOfGCName = data;
this.cdr.markForCheck();
});
this.jobManagerService
.getMetrics([
.loadMetrics([
'Status.JVM.Memory.Heap.Used',
'Status.JVM.Memory.Heap.Max',
'Status.JVM.Memory.Metaspace.Used',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import { ChangeDetectorRef, Component, OnInit, ChangeDetectionStrategy, OnDestro
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { JobManagerService } from '@flink-runtime-web/services';
import { flinkEditorOptions } from '@flink-runtime-web/share/common/editor/editor-config';
import { EditorOptions } from 'ng-zorro-antd/code-editor/typings';
import { flinkEditorOptions } from 'share/common/editor/editor-config';

import { JobManagerService } from 'services';

@Component({
selector: 'flink-job-manager-stdout',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import { ChangeDetectorRef, Component, OnInit, ChangeDetectionStrategy, OnDestro
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';

import { JobManagerService } from '@flink-runtime-web/services';
import { flinkEditorOptions } from '@flink-runtime-web/share/common/editor/editor-config';
import { EditorOptions } from 'ng-zorro-antd/code-editor/typings';
import { flinkEditorOptions } from 'share/common/editor/editor-config';

import { JobManagerService } from 'services';

@Component({
selector: 'flink-job-manager-thread-dump',
Expand Down
Loading

0 comments on commit 13ad359

Please sign in to comment.