You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2022/06/15 12:07:47 UTC

[flink] branch master updated (6b71e44ff92 -> bcf56de51ee)

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

chesnay pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


    from 6b71e44ff92 [FLINK-28006][tests] Run prod architecture tests in 1 JVM
     new fa719938441 [hotfix][tests] Streamline SubmissionBufferingTaskManagerGateway
     new 6c4c6c89fcd [hotfix][tests] Remove magic number
     new a1059cea6e6 [hotfix][tests] Always respond to task cancellation requests
     new bcf56de51ee [FLINK-28052][tests] Remove RunFailedJobListener

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../scheduler/adaptive/AdaptiveSchedulerTest.java  | 73 ++++++----------------
 1 file changed, 20 insertions(+), 53 deletions(-)


[flink] 04/04: [FLINK-28052][tests] Remove RunFailedJobListener

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit bcf56de51eeae89bcaadb37fa09c053aa3444f1f
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Jun 14 13:58:10 2022 +0200

    [FLINK-28052][tests] Remove RunFailedJobListener
    
    The RunFailedJobListener had rather obscure semantics.
    It considered a job to be terminal after it was restarted. This is awfully specific to a particular test case.
    A cleaner approach is to just cancel the job and wait for it to terminate.
    
    Additionally it considered a job as running purely based on the job status, whereas, in particular when checkpointing is involved, waiting for the tasks to be submitted is a better measure.
    In fact, testExceptionHistoryWithTaskFailureFromStopWithSavepoint was a broken since a savepoint was never triggered, as not all tasks were running.
---
 .../scheduler/adaptive/AdaptiveSchedulerTest.java  | 44 ++++------------------
 1 file changed, 7 insertions(+), 37 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
index ee3f211807e..28200416199 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
@@ -25,7 +25,6 @@ import org.apache.flink.configuration.JobManagerOptions;
 import org.apache.flink.configuration.MetricOptions;
 import org.apache.flink.configuration.SchedulerExecutionMode;
 import org.apache.flink.core.execution.SavepointFormatType;
-import org.apache.flink.core.testutils.OneShotLatch;
 import org.apache.flink.metrics.Gauge;
 import org.apache.flink.runtime.checkpoint.CheckpointException;
 import org.apache.flink.runtime.checkpoint.CheckpointIDCounter;
@@ -49,7 +48,6 @@ import org.apache.flink.runtime.executiongraph.ArchivedExecutionGraphTest;
 import org.apache.flink.runtime.executiongraph.ArchivedExecutionJobVertex;
 import org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex;
 import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
-import org.apache.flink.runtime.executiongraph.JobStatusListener;
 import org.apache.flink.runtime.executiongraph.TaskExecutionStateTransition;
 import org.apache.flink.runtime.executiongraph.failover.flip1.FixedDelayRestartBackoffTimeStrategy;
 import org.apache.flink.runtime.executiongraph.failover.flip1.NoRestartBackoffTimeStrategy;
@@ -993,36 +991,6 @@ public class AdaptiveSchedulerTest extends TestLogger {
                 .isFalse();
     }
 
-    static class RunFailedJobListener implements JobStatusListener {
-        OneShotLatch jobRunning;
-        OneShotLatch jobTerminal;
-
-        public RunFailedJobListener() {
-            this.jobRunning = new OneShotLatch();
-            this.jobTerminal = new OneShotLatch();
-        }
-
-        @Override
-        public void jobStatusChanges(JobID jobId, JobStatus newJobStatus, long timestamp) {
-            if (newJobStatus == JobStatus.RUNNING) {
-                jobRunning.trigger();
-                return;
-            }
-            boolean hasRestarted = jobRunning.isTriggered() && newJobStatus == JobStatus.CREATED;
-            if (newJobStatus == JobStatus.FAILED || hasRestarted) {
-                jobTerminal.trigger();
-            }
-        }
-
-        public void waitForRunning() throws InterruptedException {
-            jobRunning.await();
-        }
-
-        public void waitForTerminal() throws InterruptedException {
-            jobTerminal.await();
-        }
-    }
-
     private Iterable<RootExceptionHistoryEntry> runExceptionHistoryTests(
             BiConsumer<AdaptiveScheduler, List<ExecutionAttemptID>> testLogic) throws Exception {
         return runExceptionHistoryTests(testLogic, ignored -> {}, ignored -> {});
@@ -1042,7 +1010,6 @@ public class AdaptiveSchedulerTest extends TestLogger {
             throws Exception {
         final JobGraph jobGraph = createJobGraph();
         setupJobGraph.accept(jobGraph);
-        RunFailedJobListener listener = new RunFailedJobListener();
 
         final CompletedCheckpointStore completedCheckpointStore =
                 new StandaloneCompletedCheckpointStore(1);
@@ -1062,8 +1029,7 @@ public class AdaptiveSchedulerTest extends TestLogger {
                         .setJobMasterConfiguration(configuration)
                         .setDeclarativeSlotPool(declarativeSlotPool)
                         .setCheckpointRecoveryFactory(checkpointRecoveryFactory)
-                        .setCheckpointCleaner(checkpointCleaner)
-                        .setJobStatusListener(listener);
+                        .setCheckpointCleaner(checkpointCleaner);
         setupScheduler.accept(builder);
         final AdaptiveScheduler scheduler = builder.build(EXECUTOR_RESOURCE.getExecutor());
 
@@ -1090,7 +1056,10 @@ public class AdaptiveSchedulerTest extends TestLogger {
                                             ResourceProfile.UNKNOWN, PARALLELISM)),
                             taskManagerGateway);
                 });
-        listener.waitForRunning();
+        // wait for all tasks to be deployed
+        // this is important because some tests trigger savepoints
+        // these only properly work if the deployment has been started
+        taskManagerGateway.waitForSubmissions(PARALLELISM, TestingUtils.infiniteDuration());
 
         CompletableFuture<Iterable<ArchivedExecutionVertex>> vertexFuture =
                 new CompletableFuture<>();
@@ -1113,7 +1082,8 @@ public class AdaptiveSchedulerTest extends TestLogger {
                         singleThreadMainThreadExecutor);
         runTestLogicFuture.get();
 
-        listener.waitForTerminal();
+        singleThreadMainThreadExecutor.execute(scheduler::cancel);
+        scheduler.getJobTerminationFuture().get();
 
         return scheduler.requestJob().getExceptionHistory();
     }


[flink] 01/04: [hotfix][tests] Streamline SubmissionBufferingTaskManagerGateway

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit fa719938441bda7a6dc55339ad582812df95ecf8
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Jun 14 13:42:11 2022 +0200

    [hotfix][tests] Streamline SubmissionBufferingTaskManagerGateway
---
 .../apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
index 65c7b0c33f9..4d8db038d0a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
@@ -1559,7 +1559,7 @@ public class AdaptiveSchedulerTest extends TestLogger {
 
         public SubmissionBufferingTaskManagerGateway(int capacity) {
             submittedTasks = new ArrayBlockingQueue<>(capacity);
-            super.setSubmitConsumer(submittedTasks::offer);
+            setSubmitConsumer(ignored -> {});
         }
 
         @Override


[flink] 02/04: [hotfix][tests] Remove magic number

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 6c4c6c89fcd66d87a89414f0b6bb2a1d308e13a4
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Jun 14 13:46:53 2022 +0200

    [hotfix][tests] Remove magic number
---
 .../flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
index 4d8db038d0a..e454f2f136a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
@@ -1040,7 +1040,6 @@ public class AdaptiveSchedulerTest extends TestLogger {
             Consumer<AdaptiveSchedulerBuilder> setupScheduler,
             Consumer<JobGraph> setupJobGraph)
             throws Exception {
-        final int numAvailableSlots = 4;
         final JobGraph jobGraph = createJobGraph();
         setupJobGraph.accept(jobGraph);
         RunFailedJobListener listener = new RunFailedJobListener();
@@ -1070,7 +1069,7 @@ public class AdaptiveSchedulerTest extends TestLogger {
         final AdaptiveScheduler scheduler = builder.build(EXECUTOR_RESOURCE.getExecutor());
 
         final SubmissionBufferingTaskManagerGateway taskManagerGateway =
-                new SubmissionBufferingTaskManagerGateway(numAvailableSlots);
+                new SubmissionBufferingTaskManagerGateway(PARALLELISM);
         taskManagerGateway.setCancelConsumer(cancelledTasks::add);
 
         singleThreadMainThreadExecutor.execute(
@@ -1080,7 +1079,7 @@ public class AdaptiveSchedulerTest extends TestLogger {
                             declarativeSlotPool,
                             createSlotOffersForResourceRequirements(
                                     ResourceCounter.withResource(
-                                            ResourceProfile.UNKNOWN, numAvailableSlots)),
+                                            ResourceProfile.UNKNOWN, PARALLELISM)),
                             taskManagerGateway);
                 });
         listener.waitForRunning();


[flink] 03/04: [hotfix][tests] Always respond to task cancellation requests

Posted by ch...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit a1059cea6e696fc1c0bcbb37e63db61d8163619c
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Jun 14 13:49:19 2022 +0200

    [hotfix][tests] Always respond to task cancellation requests
    
    The previous cancel setup doesn't make sense if you aren't aware that one of the tests forces a restart.
    We now immediately respond to any task cancellation request instead.
---
 .../scheduler/adaptive/AdaptiveSchedulerTest.java  | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
index e454f2f136a..ee3f211807e 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveSchedulerTest.java
@@ -1043,7 +1043,6 @@ public class AdaptiveSchedulerTest extends TestLogger {
         final JobGraph jobGraph = createJobGraph();
         setupJobGraph.accept(jobGraph);
         RunFailedJobListener listener = new RunFailedJobListener();
-        List<ExecutionAttemptID> cancelledTasks = new ArrayList<>();
 
         final CompletedCheckpointStore completedCheckpointStore =
                 new StandaloneCompletedCheckpointStore(1);
@@ -1070,7 +1069,16 @@ public class AdaptiveSchedulerTest extends TestLogger {
 
         final SubmissionBufferingTaskManagerGateway taskManagerGateway =
                 new SubmissionBufferingTaskManagerGateway(PARALLELISM);
-        taskManagerGateway.setCancelConsumer(cancelledTasks::add);
+        taskManagerGateway.setCancelConsumer(
+                attemptId ->
+                        singleThreadMainThreadExecutor.execute(
+                                () ->
+                                        scheduler.updateTaskExecutionState(
+                                                new TaskExecutionStateTransition(
+                                                        new TaskExecutionState(
+                                                                attemptId,
+                                                                ExecutionState.CANCELED,
+                                                                null)))));
 
         singleThreadMainThreadExecutor.execute(
                 () -> {
@@ -1105,16 +1113,6 @@ public class AdaptiveSchedulerTest extends TestLogger {
                         singleThreadMainThreadExecutor);
         runTestLogicFuture.get();
 
-        Consumer<ExecutionAttemptID> canceller =
-                attemptId ->
-                        scheduler.updateTaskExecutionState(
-                                new TaskExecutionStateTransition(
-                                        new TaskExecutionState(
-                                                attemptId, ExecutionState.CANCELED, null)));
-        CompletableFuture<Void> cancelFuture =
-                CompletableFuture.runAsync(
-                        () -> cancelledTasks.forEach(canceller), singleThreadMainThreadExecutor);
-        cancelFuture.get();
         listener.waitForTerminal();
 
         return scheduler.requestJob().getExceptionHistory();