This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new 29ce52801 [Fix-3755] Application status inconsistence with yarn (#3756)
29ce52801 is described below

commit 29ce528012caacf1fecc24b66043d4ccee09695a
Author: xiangzihao <[email protected]>
AuthorDate: Sat Jun 15 11:45:20 2024 +0800

    [Fix-3755] Application status inconsistence with yarn (#3756)
    
    * fix issue 3755
---
 .github/actions/paths-filter                       |  1 +
 .github/workflows/backend.yml                      | 29 ++++++++++++-----
 .github/workflows/docs.yml                         | 36 +++++++++++++++++++---
 .github/workflows/e2e.yml                          | 24 ++++++++++++---
 .github/workflows/frontend.yml                     | 27 +++++++++++-----
 .github/workflows/unit-test.yml                    | 27 +++++++++++-----
 .gitmodules                                        | 21 +++++++++++++
 .../console/core/watcher/FlinkAppHttpWatcher.java  | 19 +++++++-----
 8 files changed, 147 insertions(+), 37 deletions(-)

diff --git a/.github/actions/paths-filter b/.github/actions/paths-filter
new file mode 160000
index 000000000..de90cc6fb
--- /dev/null
+++ b/.github/actions/paths-filter
@@ -0,0 +1 @@
+Subproject commit de90cc6fb38fc0963ad72b210f1f284cd68cea36
diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml
index 2ade9ba8c..b806460ed 100644
--- a/.github/workflows/backend.yml
+++ b/.github/workflows/backend.yml
@@ -29,11 +29,6 @@ on:
       - 'script/**'
       - 'streampark-console/streampark-console-webapp/**'
   pull_request:
-    paths-ignore:
-      - '**.md'
-      - 'deploy/**'
-      - 'script/**'
-      - 'streampark-console/streampark-console-webapp/**'
 
 
 concurrency:
@@ -41,10 +36,24 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
+  paths-filter:
+    name: Unit-Test-Path-Filter
+    runs-on: ubuntu-latest
+    outputs:
+      not-ignore: ${{ steps.filter.outputs.not-ignore }}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: dorny/paths-filter@v3
+        id: filter
+        with:
+          filters: |
+            not-ignore:
+              - '!(**.md)'
   license-header:
-    if: github.repository == 'apache/incubator-streampark'
     name: License header
     runs-on: ubuntu-latest
+    if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || 
(github.event_name == 'push') }}
+    needs: paths-filter
     timeout-minutes: 10
     steps:
       - uses: actions/checkout@v3
@@ -56,6 +65,7 @@ jobs:
     if: github.repository == 'apache/incubator-streampark'
     name: Code style
     runs-on: ubuntu-latest
+    needs: license-header
     timeout-minutes: 10
     steps:
       - uses: actions/checkout@v3
@@ -66,6 +76,7 @@ jobs:
   build:
     name: "Backend-Build (java-${{ matrix.java }})"
     runs-on: ubuntu-latest
+    needs: code-style
     strategy:
       fail-fast: false
       matrix:
@@ -85,11 +96,15 @@ jobs:
     name: Backend - Result
     runs-on: ubuntu-latest
     timeout-minutes: 30
-    needs: [ build, license-header, code-style ]
+    needs: [ paths-filter, build, license-header, code-style ]
     if: always()
     steps:
       - name: Status
         run: |
+          if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ 
github.event_name }} == 'pull_request' ]]; then
+            echo "Skip Backend!"
+            exit 0
+          fi
           if [[ ${{ contains(needs.*.result, 'success') }} != 'true' ]]; then
             echo "Backend Build Failed!"
             exit -1
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 29caba107..ff862f870 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -25,8 +25,6 @@ on:
     paths:
       - '**.md'
   pull_request:
-    paths:
-      - '**.md'
 
 
 name: Docs
@@ -38,10 +36,35 @@ concurrency:
 
 
 jobs:
+  paths-filter:
+    name: Docs-Path-Filter
+    runs-on: ubuntu-latest
+    outputs:
+      not-ignore: ${{ steps.filter.outputs.not-ignore }}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: dorny/paths-filter@v3
+        id: filter
+        with:
+          filters: |
+            not-ignore:
+              - '**.md'
+  license-header:
+    name: License header
+    runs-on: ubuntu-latest
+    if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || 
(github.event_name == 'push') }}
+    needs: paths-filter
+    timeout-minutes: 10
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: true
+      - name: Check license header
+        uses: apache/skywalking-eyes/header@main
   dead-link:
-    if: github.repository == 'apache/incubator-streampark'
     name: Dead links
     runs-on: ubuntu-latest
+    needs: license-header
     timeout-minutes: 20
     steps:
       - uses: actions/checkout@v3
@@ -54,13 +77,16 @@ jobs:
     name: Docs - Result
     runs-on: ubuntu-latest
     timeout-minutes: 30
-    needs:
-      - dead-link
+    needs: [ paths-filter, license-header, dead-link ]
     if: always()
     steps:
       - uses: actions/checkout@v4
       - name: Status
         run: |
+          if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ 
github.event_name }} == 'pull_request' ]]; then
+            echo "Skip Frontend!"
+            exit 0
+          fi
           if [[ ${{ contains(needs.*.result, 'failure') }} == 'true' || ${{ 
contains(needs.*.result, 'cancelled') }} == 'true' ]]; then
             echo "Docs check Failed!"
             exit 1
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index baa3e9642..01de25027 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -17,8 +17,6 @@
 
 on:
   pull_request:
-    paths-ignore:
-      - '**.md'
   push:
     branches:
       - dev
@@ -33,10 +31,24 @@ concurrency:
 
 
 jobs:
+  paths-filter:
+    name: E2E-Path-Filter
+    runs-on: ubuntu-latest
+    outputs:
+      not-ignore: ${{ steps.filter.outputs.not-ignore }}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: dorny/paths-filter@v3
+        id: filter
+        with:
+          filters: |
+            not-ignore:
+              - '!(**.md)'
   license-header:
-    if: github.repository == 'apache/incubator-streampark'
     name: License header
     runs-on: ubuntu-latest
+    if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || 
(github.event_name == 'push') }}
+    needs: paths-filter
     timeout-minutes: 10
     steps:
       - uses: actions/checkout@v4
@@ -126,11 +138,15 @@ jobs:
     name: E2E - Result
     runs-on: ubuntu-latest
     timeout-minutes: 30
-    needs: e2e
+    needs: [ paths-filter, license-header, build, e2e ]
     if: always()
     steps:
       - name: Status
         run: |
+          if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ 
github.event_name }} == 'pull_request' ]]; then
+            echo "Skip E2E!"
+            exit 0
+          fi
           if [[ ${{ needs.e2e.result }} != 'success' ]]; then
             echo "E2E Failed!"
             exit -1
diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml
index 1dbc52f38..012cd6b38 100644
--- a/.github/workflows/frontend.yml
+++ b/.github/workflows/frontend.yml
@@ -20,13 +20,7 @@ on:
   push:
     branches:
       - dev
-    paths:
-      - '.github/workflows/frontend.yml'
-      - 'streampark-console/streampark-console-webapp/**'
   pull_request:
-    paths:
-      - '.github/workflows/frontend.yml'
-      - 'streampark-console/streampark-console-webapp/**'
 
 defaults:
   run:
@@ -37,9 +31,24 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
+  paths-filter:
+    name: Frontend-Path-Filter
+    runs-on: ubuntu-latest
+    outputs:
+      not-ignore: ${{ steps.filter.outputs.not-ignore }}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: dorny/paths-filter@v3
+        id: filter
+        with:
+          filters: |
+            not-ignore:
+              - '!(**.md)'
   build:
     name: Build
     runs-on: ${{ matrix.os }}
+    if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || 
(github.event_name == 'push') }}
+    needs: paths-filter
     timeout-minutes: 20
     strategy:
       matrix:
@@ -62,12 +71,16 @@ jobs:
     name: Frontend - Result
     runs-on: ubuntu-latest
     timeout-minutes: 30
-    needs: [ build ]
+    needs: [ paths-filter, build, build ]
     if: always()
     steps:
       - uses: actions/checkout@v4
       - name: Status
         run: |
+          if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ 
github.event_name }} == 'pull_request' ]]; then
+            echo "Skip Frontend!"
+            exit 0
+          fi
           if [[ ${{ contains(needs.*.result, 'success') }} != 'true' ]]; then
             echo "Frontend Build Failed!"
             exit -1
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index c3269e648..f15d1ccf2 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -29,11 +29,6 @@ on:
       - 'script/**'
       - 'streampark-console/streampark-console-webapp/**'
   pull_request:
-    paths-ignore:
-      - '**.md'
-      - 'deploy/**'
-      - 'script/**'
-      - 'streampark-console/streampark-console-webapp/**'
 
 
 concurrency:
@@ -41,10 +36,24 @@ concurrency:
   cancel-in-progress: true
 
 jobs:
+  paths-filter:
+    name: Unit-Test-Path-Filter
+    runs-on: ubuntu-latest
+    outputs:
+      not-ignore: ${{ steps.filter.outputs.not-ignore }}
+    steps:
+      - uses: actions/checkout@v3
+      - uses: dorny/paths-filter@v3
+        id: filter
+        with:
+          filters: |
+            not-ignore:
+              - '!(**.md)'
   license-header:
-    if: github.repository == 'apache/incubator-streampark'
     name: License header
     runs-on: ubuntu-latest
+    if: ${{ (needs.paths-filter.outputs.not-ignore == 'true') || 
(github.event_name == 'push') }}
+    needs: paths-filter
     timeout-minutes: 10
     steps:
       - uses: actions/checkout@v3
@@ -85,12 +94,16 @@ jobs:
     name: Unit-Test - Result
     runs-on: ubuntu-latest
     timeout-minutes: 30
-    needs: [ unit-test, license-header, code-style ]
+    needs: [ paths-filter, unit-test, license-header, code-style ]
     if: always()
     steps:
       - uses: actions/checkout@v4
       - name: Status
         run: |
+          if [[ ${{ needs.paths-filter.outputs.not-ignore }} == 'false' && ${{ 
github.event_name }} == 'pull_request' ]]; then
+            echo "Skip Unit-Test!"
+            exit 0
+          fi
           if [[ ${{ contains(needs.*.result, 'success') }} != 'true' ]]; then
             echo "Unit-Test Failed!"
             exit -1
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..c8b053c7b
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,21 @@
+# Licensed to 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. Apache Software Foundation (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.
+
+[submodule ".github/actions/paths-filter"]
+       path = .github/actions/paths-filter
+       url = https://github.com/dorny/paths-filter.git
+       branch = de90cc6fb38fc0963ad72b210f1f284cd68cea36
diff --git 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/watcher/FlinkAppHttpWatcher.java
 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/watcher/FlinkAppHttpWatcher.java
index 4cc490811..12afd7f11 100644
--- 
a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/watcher/FlinkAppHttpWatcher.java
+++ 
b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/watcher/FlinkAppHttpWatcher.java
@@ -240,9 +240,10 @@ public class FlinkAppHttpWatcher {
     JobsOverview jobsOverview = httpJobsOverview(application);
     Optional<JobsOverview.Job> jobOptional = getJobsOverviewJob(application, 
jobsOverview);
     if (jobOptional.isPresent()) {
-
       processJobState(application, jobOptional);
     }
+    log.debug(
+        "getStateFromFlink abnormal, application: {}, jobsOverview: {}", 
application, jobsOverview);
   }
 
   private void processJobState(Application application, 
Optional<JobsOverview.Job> jobOptional)
@@ -279,12 +280,16 @@ public class FlinkAppHttpWatcher {
     Optional<JobsOverview.Job> optional;
     FlinkExecutionMode execMode = application.getFlinkExecutionMode();
     if (FlinkExecutionMode.isYarnPerJobOrAppMode(execMode)) {
-      optional =
-          !jobsOverview.getJobs().isEmpty()
-              ? jobsOverview.getJobs().stream()
-                  .filter(a -> StringUtils.equals(application.getJobId(), 
a.getId()))
-                  .findFirst()
-              : Optional.empty();
+      if (jobsOverview.getJobs() != null) {
+        optional =
+            jobsOverview.getJobs().size() > 1
+                ? jobsOverview.getJobs().stream()
+                    .filter(a -> StringUtils.equals(application.getJobId(), 
a.getId()))
+                    .findFirst()
+                : jobsOverview.getJobs().stream().findFirst();
+      } else {
+        optional = Optional.empty();
+      }
     } else {
       optional =
           jobsOverview.getJobs().stream()

Reply via email to