zhuzhurk commented on code in PR #27655:
URL: https://github.com/apache/flink/pull/27655#discussion_r2851618281


##########
flink-runtime-web/web-dashboard/src/app/pages/application/exceptions/application-exceptions.component.ts:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+
+import { formatDate } from '@angular/common';
+import { Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef, 
OnDestroy } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { Subject } from 'rxjs';
+import { distinctUntilChanged, mergeMap, takeUntil, tap } from 
'rxjs/operators';
+
+import { AutoResizeDirective } from 
'@flink-runtime-web/components/editor/auto-resize.directive';
+import { flinkEditorOptions } from 
'@flink-runtime-web/components/editor/editor-config';
+import { ExceptionInfo } from '@flink-runtime-web/interfaces';
+import { ApplicationService } from '@flink-runtime-web/services';
+import { NzButtonModule } from 'ng-zorro-antd/button';
+import { NzCodeEditorModule, EditorOptions } from 'ng-zorro-antd/code-editor';
+import { NzIconModule } from 'ng-zorro-antd/icon';
+import { NzSelectModule } from 'ng-zorro-antd/select';
+import { NzTableModule } from 'ng-zorro-antd/table';
+import { NzTabsModule } from 'ng-zorro-antd/tabs';
+import { NzTagModule } from 'ng-zorro-antd/tag';
+import { NzTooltipModule } from 'ng-zorro-antd/tooltip';
+
+import { ApplicationLocalService } from '../application-local.service';
+
+@Component({
+  selector: 'flink-application-exceptions',
+  templateUrl: './application-exceptions.component.html',
+  styleUrls: ['./application-exceptions.component.less'],
+  changeDetection: ChangeDetectionStrategy.OnPush,
+  imports: [
+    NzTabsModule,
+    NzCodeEditorModule,
+    AutoResizeDirective,
+    NzTableModule,
+    NzSelectModule,
+    NzTooltipModule,
+    FormsModule,
+    NzIconModule,
+    NzButtonModule,
+    NzTagModule
+  ]
+})
+export class ApplicationExceptionsComponent implements OnInit, OnDestroy {
+  public readonly trackByTimestamp = (_: number, node: ExceptionInfo): number 
=> node.timestamp;
+
+  public rootException = '';
+  public isLoading = false;
+  public total = 0;
+  public editorOptions: EditorOptions = flinkEditorOptions;
+
+  private readonly destroy$ = new Subject<void>();
+
+  constructor(
+    private readonly applicationService: ApplicationService,
+    private readonly applicationLocalService: ApplicationLocalService,
+    private readonly cdr: ChangeDetectorRef
+  ) {}
+
+  public ngOnInit(): void {
+    this.loadMore();
+  }
+
+  public ngOnDestroy(): void {
+    this.destroy$.next();
+    this.destroy$.complete();
+  }
+
+  public loadMore(): void {
+    this.isLoading = true;
+    this.applicationLocalService
+      .applicationDetailChanges()
+      .pipe(
+        distinctUntilChanged((pre, next) => pre.id === next.id),
+        mergeMap(application => 
this.applicationService.loadExceptions(application.id)),
+        tap(() => {
+          this.isLoading = false;
+          this.cdr.markForCheck();
+        }),
+        takeUntil(this.destroy$)
+      )
+      .subscribe(data => {
+        // @ts-ignore
+        const exceptionHistory = data.exceptionHistory;
+        if (exceptionHistory.entries.length > 0) {
+          const exceptionInfo = exceptionHistory.entries[0];
+          this.rootException = `${formatDate(exceptionInfo.timestamp, 
'yyyy-MM-dd HH:mm:ss', 'en')}\n${

Review Comment:
   It's better to also print the related job if the root cause is a job failure.



##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -697,6 +698,28 @@ public void notifyApplicationStatusChange(
                 stateTimestamps[ordinal] = 
application.getStatusTimestamp(applicationState);
             }
 
+            //            if (application instanceof SingleJobApplication) {
+            //                checkState(
+            //                        application.getJobs().size() == 1,
+            //                        "SingleJobApplication must have one 
job.");
+            //
+            //                JobID jobId = 
application.getJobs().iterator().next();
+            //                try {
+            //                    JobResult jobResult =
+            //                            requestJobResult(
+            //                                            jobId,
+            //
+            // configuration.get(RpcOptions.ASK_TIMEOUT_DURATION))
+            //                                    .get();
+            //                    if 
(jobResult.getSerializedThrowable().isPresent()) {
+            //                        application.addExceptionHistoryEntry(
+            //                                
jobResult.getSerializedThrowable().get(), jobId);
+            //                    }
+            //                } catch (Exception e) {
+            //                    log.warn("Failed to get job result for job 
{}", jobId);
+            //                }
+            //            }

Review Comment:
   Unwanted changes?



##########
flink-clients/src/main/java/org/apache/flink/client/deployment/application/PackagedProgramApplication.java:
##########
@@ -196,13 +200,21 @@ public CompletableFuture<Acknowledge> execute(
                                                     dispatcherGateway, 
ApplicationStatus.SUCCEEDED);
                                         }
 
-                                        final Optional<JobStatus> 
maybeJobStatus =
-                                                extractJobStatus(t);
-                                        if (maybeJobStatus.isPresent()) {
+                                        final 
Optional<UnsuccessfulExecutionException>
+                                                maybeJobFailure = 
extractJobFailure(t);
+                                        if (maybeJobFailure.isPresent()
+                                                && isCanceledOrFailed(

Review Comment:
   In what case does a job fail, but the status is neither "Failed" nor 
"Canceled"?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to