You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/10/18 14:53:09 UTC

[flink] 04/07: [FLINK-10508] Port jobs cases

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

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

commit 9792823fe679054b66af6a5bec3290b7f972d7f3
Author: 陈梓立 <wa...@gmail.com>
AuthorDate: Fri Oct 12 14:49:27 2018 +0800

    [FLINK-10508] Port jobs cases
    
    All of cases below are ported to MiniClusterITCase#... corresponding.
    
    1. JobManagerITCase.The JobManager actor must support forward jobs
    2. JobManagerITCase.The JobManager actor must support bipartite job
    3. JobManagerITCase.The JobManager actor must support two input job failing edge mismatch
    4. JobManagerITCase.The JobManager actor must support two input job
    5. JobManagerITCase.The JobManager actor must support scheduling all at once
    6. JobManagerITCase.The JobManager actor must handle job with a failing sender vertex
    7. JobManagerITCase.The JobManager actor must handle job with an occasionally failing sender vertex
    8. JobManagerITCase.The JobManager actor must handle job with a failing receiver vertex
    9. JobManagerITCase.The JobManager actor must handle job with all vertices failing during instantiation
    10. JobManagerITCase.The JobManager actor must handle job with some vertices failing during instantiation
    11. JobManagerITCase.The JobManager actor must check that all job vertices have completed the call to finalizeOnMaster before the job completes
---
 .../runtime/minicluster/MiniClusterITCase.java     | 491 ++++++++++++++++++++-
 .../minicluster/SometimesExceptionSender.java      |  64 +++
 .../SometimesInstantiationErrorSender.java         |  52 +++
 .../runtime/jobmanager/JobManagerITCase.scala      | 467 --------------------
 .../apache/flink/runtime/jobmanager/Tasks.scala    |  37 --
 5 files changed, 590 insertions(+), 521 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/MiniClusterITCase.java b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/MiniClusterITCase.java
index cba389f..c005de9 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/MiniClusterITCase.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/MiniClusterITCase.java
@@ -25,21 +25,40 @@ import org.apache.flink.api.common.restartstrategy.RestartStrategies;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.JobManagerOptions;
 import org.apache.flink.configuration.RestOptions;
-import org.apache.flink.runtime.clusterframework.ApplicationStatus;
+import org.apache.flink.core.testutils.OneShotLatch;
+import org.apache.flink.runtime.client.JobExecutionException;
+import org.apache.flink.runtime.io.network.partition.ResultPartitionType;
+import org.apache.flink.runtime.jobgraph.DistributionPattern;
 import org.apache.flink.runtime.jobgraph.JobGraph;
 import org.apache.flink.runtime.jobgraph.JobVertex;
 import org.apache.flink.runtime.jobgraph.ScheduleMode;
+import org.apache.flink.runtime.jobmanager.Tasks.AgnosticBinaryReceiver;
+import org.apache.flink.runtime.jobmanager.Tasks.AgnosticReceiver;
+import org.apache.flink.runtime.jobmanager.Tasks.AgnosticTertiaryReceiver;
+import org.apache.flink.runtime.jobmanager.Tasks.ExceptionReceiver;
+import org.apache.flink.runtime.jobmanager.Tasks.ExceptionSender;
+import org.apache.flink.runtime.jobmanager.Tasks.Forwarder;
+import org.apache.flink.runtime.jobmanager.Tasks.InstantiationErrorSender;
+import org.apache.flink.runtime.jobmanager.Tasks.Receiver;
+import org.apache.flink.runtime.jobmanager.Tasks.Sender;
 import org.apache.flink.runtime.jobmanager.scheduler.NoResourceAvailableException;
+import org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup;
 import org.apache.flink.runtime.jobmaster.JobResult;
 import org.apache.flink.runtime.testtasks.BlockingNoOpInvokable;
 import org.apache.flink.runtime.testtasks.NoOpInvokable;
-import org.apache.flink.util.ExceptionUtils;
+import org.apache.flink.runtime.testtasks.WaitingNoOpInvokable;
 import org.apache.flink.util.TestLogger;
 
-import org.junit.Assert;
 import org.junit.Test;
 
 import java.io.IOException;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.flink.util.ExceptionUtils.findThrowable;
+import static org.apache.flink.util.ExceptionUtils.findThrowableWithMessage;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * Integration test cases for the {@link MiniCluster}.
@@ -102,25 +121,444 @@ public class MiniClusterITCase extends TestLogger {
 			vertex.setMaxParallelism(2);
 			vertex.setInvokableClass(BlockingNoOpInvokable.class);
 
-			final JobGraph graph = new JobGraph("Test Job", vertex);
-			graph.setScheduleMode(ScheduleMode.EAGER);
+			final JobGraph jobGraph = new JobGraph("Test Job", vertex);
+			jobGraph.setScheduleMode(ScheduleMode.EAGER);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowableWithMessage(e, "Job execution failed.").isPresent());
+
+				assertTrue(findThrowable(e, NoResourceAvailableException.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Slots required: 2, slots allocated: 1").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testForwardJob() throws Exception {
+		final int parallelism = 31;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(Sender.class);
+			sender.setParallelism(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(Receiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			miniCluster.executeJobBlocking(jobGraph);
+		}
+	}
+
+	@Test
+	public void testBipartiteJob() throws Exception {
+		final int parallelism = 31;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(Sender.class);
+			sender.setParallelism(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(AgnosticReceiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Bipartite Job", sender, receiver);
+
+			miniCluster.executeJobBlocking(jobGraph);
+		}
+	}
+
+	@Test
+	public void testTwoInputJobFailingEdgeMismatch() throws Exception {
+		final int parallelism = 1;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(6 * parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender1 = new JobVertex("Sender1");
+			sender1.setInvokableClass(Sender.class);
+			sender1.setParallelism(parallelism);
+
+			final JobVertex sender2 = new JobVertex("Sender2");
+			sender2.setInvokableClass(Sender.class);
+			sender2.setParallelism(2 * parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(AgnosticTertiaryReceiver.class);
+			receiver.setParallelism(3 * parallelism);
 
-			final JobSubmissionResult submissionResult = miniCluster.submitJob(graph).get();
-			Assert.assertEquals(graph.getJobID(), submissionResult.getJobID());
+			receiver.connectNewDataSetAsInput(sender1, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+			receiver.connectNewDataSetAsInput(sender2, DistributionPattern.ALL_TO_ALL,
+				ResultPartitionType.PIPELINED);
 
-			final JobResult jobResult = miniCluster.requestJobResult(graph.getJobID()).get();
+			final JobGraph jobGraph = new JobGraph("Bipartite Job", sender1, receiver, sender2);
 
-			Assert.assertEquals(graph.getJobID(), jobResult.getJobId());
-			Assert.assertEquals(ApplicationStatus.FAILED, jobResult.getApplicationStatus());
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
 
-			Assert.assertTrue(jobResult.getSerializedThrowable().isPresent());
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, ArrayIndexOutOfBoundsException.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "2").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testTwoInputJob() throws Exception {
+		final int parallelism = 11;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(6 * parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender1 = new JobVertex("Sender1");
+			sender1.setInvokableClass(Sender.class);
+			sender1.setParallelism(parallelism);
+
+			final JobVertex sender2 = new JobVertex("Sender2");
+			sender2.setInvokableClass(Sender.class);
+			sender2.setParallelism(2 * parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(AgnosticBinaryReceiver.class);
+			receiver.setParallelism(3 * parallelism);
+
+			receiver.connectNewDataSetAsInput(sender1, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+			receiver.connectNewDataSetAsInput(sender2, DistributionPattern.ALL_TO_ALL,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Bipartite Job", sender1, receiver, sender2);
+
+			miniCluster.executeJobBlocking(jobGraph);
+		}
+	}
+
+	@Test
+	public void testSchedulingAllAtOnce() throws Exception {
+		final int parallelism = 16;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(Sender.class);
+			sender.setParallelism(parallelism);
+
+			final JobVertex forwarder = new JobVertex("Forwarder");
+			forwarder.setInvokableClass(Forwarder.class);
+			forwarder.setParallelism(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(AgnosticReceiver.class);
+			receiver.setParallelism(parallelism);
+
+			final SlotSharingGroup sharingGroup = new SlotSharingGroup(sender.getID(), receiver.getID());
+			sender.setSlotSharingGroup(sharingGroup);
+			forwarder.setSlotSharingGroup(sharingGroup);
+			receiver.setSlotSharingGroup(sharingGroup);
 
-			final Throwable cause = jobResult.getSerializedThrowable().get()
-				.deserializeError(getClass().getClassLoader());
+			forwarder.connectNewDataSetAsInput(sender, DistributionPattern.ALL_TO_ALL,
+				ResultPartitionType.PIPELINED);
+			receiver.connectNewDataSetAsInput(forwarder, DistributionPattern.ALL_TO_ALL,
+				ResultPartitionType.PIPELINED);
 
-			Assert.assertTrue(ExceptionUtils.findThrowable(cause, NoResourceAvailableException.class).isPresent());
-			Assert.assertTrue(ExceptionUtils
-				.findThrowableWithMessage(cause, "Slots required: 2, slots allocated: 1").isPresent());
+			final JobGraph jobGraph = new JobGraph("Forwarding Job", sender, forwarder, receiver);
+
+			jobGraph.setScheduleMode(ScheduleMode.EAGER);
+
+			miniCluster.executeJobBlocking(jobGraph);
+		}
+	}
+
+	@Test
+	public void testJobWithAFailingSenderVertex() throws Exception {
+		final int parallelism = 100;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(ExceptionSender.class);
+			sender.setParallelism(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(Receiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, Exception.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Test exception").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testJobWithAnOccasionallyFailingSenderVertex() throws Exception {
+		final int parallelism = 100;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(SometimesExceptionSender.class);
+			sender.setParallelism(parallelism);
+
+			// set failing senders
+			SometimesExceptionSender.configFailingSenders(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(Receiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, Exception.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Test exception").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testJobWithAFailingReceiverVertex() throws Exception {
+		final int parallelism = 200;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(Sender.class);
+			sender.setParallelism(parallelism);
+
+			// set failing senders
+			SometimesExceptionSender.configFailingSenders(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(ExceptionReceiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, Exception.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Test exception").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testJobWithAllVerticesFailingDuringInstantiation() throws Exception {
+		final int parallelism = 200;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(InstantiationErrorSender.class);
+			sender.setParallelism(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(Receiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, Exception.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Test exception in constructor").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testJobWithSomeVerticesFailingDuringInstantiation() throws Exception {
+		final int parallelism = 200;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex sender = new JobVertex("Sender");
+			sender.setInvokableClass(SometimesInstantiationErrorSender.class);
+			sender.setParallelism(parallelism);
+
+			// set failing senders
+			SometimesInstantiationErrorSender.configFailingSenders(parallelism);
+
+			final JobVertex receiver = new JobVertex("Receiver");
+			receiver.setInvokableClass(Receiver.class);
+			receiver.setParallelism(parallelism);
+
+			receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
+
+			try {
+				miniCluster.executeJobBlocking(jobGraph);
+
+				fail("Job should fail.");
+			} catch (JobExecutionException e) {
+				assertTrue(findThrowable(e, Exception.class).isPresent());
+				assertTrue(findThrowableWithMessage(e, "Test exception in constructor").isPresent());
+			}
+		}
+	}
+
+	@Test
+	public void testCallFinalizeOnMasterBeforeJobCompletes() throws Exception {
+		final int parallelism = 31;
+
+		final MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
+			.setNumTaskManagers(1)
+			.setNumSlotsPerTaskManager(parallelism)
+			.setRpcServiceSharing(RpcServiceSharing.DEDICATED)
+			.setConfiguration(getDefaultConfiguration())
+			.build();
+
+		try (final MiniCluster miniCluster = new MiniCluster(cfg)) {
+			miniCluster.start();
+
+			final JobVertex source = new JobVertex("Source");
+			source.setInvokableClass(WaitingNoOpInvokable.class);
+			source.setParallelism(parallelism);
+
+			final WaitOnFinalizeJobVertex sink = new WaitOnFinalizeJobVertex("Sink", 500L);
+			sink.setInvokableClass(NoOpInvokable.class);
+			sink.setParallelism(parallelism);
+
+			sink.connectNewDataSetAsInput(source, DistributionPattern.POINTWISE,
+				ResultPartitionType.PIPELINED);
+
+			final JobGraph jobGraph = new JobGraph("SubtaskInFinalStateRaceCondition", source, sink);
+
+			final CompletableFuture<JobSubmissionResult> submissionFuture = miniCluster.submitJob(jobGraph);
+
+			final CompletableFuture<JobResult> jobResultFuture = submissionFuture.thenCompose(
+				(JobSubmissionResult ignored) -> miniCluster.requestJobResult(jobGraph.getJobID()));
+
+			sink.latch.await();
+
+			assertFalse(jobResultFuture.isDone());
+			jobResultFuture.get().toJobExecutionResult(getClass().getClassLoader());
 		}
 	}
 
@@ -142,7 +580,6 @@ public class MiniClusterITCase extends TestLogger {
 		task.setInvokableClass(NoOpInvokable.class);
 
 		final JobGraph jg = new JobGraph(new JobID(), "Test Job", task);
-		jg.setAllowQueuedScheduling(true);
 		jg.setScheduleMode(ScheduleMode.EAGER);
 
 		final ExecutionConfig executionConfig = new ExecutionConfig();
@@ -151,4 +588,24 @@ public class MiniClusterITCase extends TestLogger {
 
 		return jg;
 	}
+
+	private static class WaitOnFinalizeJobVertex extends JobVertex {
+
+		private OneShotLatch latch;
+
+		private final long waitingTime;
+
+		WaitOnFinalizeJobVertex(String name, long waitingTime) {
+			super(name);
+
+			this.latch = new OneShotLatch();
+			this.waitingTime = waitingTime;
+		}
+
+		@Override
+		public void finalizeOnMaster(ClassLoader loader) throws Exception {
+			Thread.sleep(waitingTime);
+			latch.trigger();
+		}
+	}
 }
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesExceptionSender.java b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesExceptionSender.java
new file mode 100644
index 0000000..6ed3c4d
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesExceptionSender.java
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.runtime.minicluster;
+
+import org.apache.flink.runtime.execution.Environment;
+import org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+/**
+ * {@link org.apache.flink.runtime.testtasks.BlockingNoOpInvokable} that sometimes fails.
+ */
+public class SometimesExceptionSender extends AbstractInvokable {
+
+	private static Set<Integer> failingSenders;
+
+	private static final Random RANDOM = new Random();
+
+	public SometimesExceptionSender(Environment environment) {
+		super(environment);
+	}
+
+	static void configFailingSenders(int numOfTasks) {
+		failingSenders = new HashSet<>();
+
+		while (failingSenders.size() < 10) {
+			failingSenders.add(RANDOM.nextInt(numOfTasks));
+		}
+	}
+
+	@Override
+	public void invoke() throws Exception {
+		if (failingSenders.contains(this.getIndexInSubtaskGroup())) {
+			throw new Exception("Test exception");
+		} else {
+			final Object o = new Object();
+			//noinspection SynchronizationOnLocalVariableOrMethodParameter
+			synchronized (o) {
+				//noinspection InfiniteLoopStatement
+				while (true) {
+					o.wait();
+				}
+			}
+		}
+	}
+}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesInstantiationErrorSender.java b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesInstantiationErrorSender.java
new file mode 100644
index 0000000..d632da3
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/minicluster/SometimesInstantiationErrorSender.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.runtime.minicluster;
+
+import org.apache.flink.runtime.execution.Environment;
+import org.apache.flink.runtime.testtasks.BlockingNoOpInvokable;
+
+import java.util.HashSet;
+import java.util.Random;
+import java.util.Set;
+
+/**
+ * {@link org.apache.flink.runtime.testtasks.BlockingNoOpInvokable} that sometimes fails on constructor.
+ */
+public class SometimesInstantiationErrorSender extends BlockingNoOpInvokable {
+
+	private static Set<Integer> failingSenders;
+
+	private static final Random RANDOM = new Random();
+
+	public SometimesInstantiationErrorSender(Environment environment) {
+		super(environment);
+
+		if (failingSenders.contains(this.getIndexInSubtaskGroup())) {
+			throw new RuntimeException("Test exception in constructor");
+		}
+	}
+
+	static void configFailingSenders(int numOfTasks) {
+		failingSenders = new HashSet<>();
+
+		while (failingSenders.size() < 10) {
+			failingSenders.add(RANDOM.nextInt(numOfTasks));
+		}
+	}
+}
diff --git a/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerITCase.scala b/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerITCase.scala
index d9e3d19..df3fd44 100644
--- a/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerITCase.scala
+++ b/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/JobManagerITCase.scala
@@ -66,473 +66,6 @@ class JobManagerITCase(_system: ActorSystem)
 
   "The JobManager actor" must {
 
-    "support forward jobs" in {
-      val num_tasks = 31
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[Sender])
-      receiver.setInvokableClass(classOf[Receiver])
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise Job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(2 * num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val result = expectMsgType[JobResultSuccess]
-
-          result.result.getJobId() should equal(jobGraph.getJobID)
-        }
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "support bipartite job" in {
-      val num_tasks = 31
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[Sender])
-      receiver.setInvokableClass(classOf[AgnosticReceiver])
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Bipartite Job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(2 * num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          expectMsgType[JobResultSuccess]
-        }
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "support two input job failing edge mismatch" in {
-      val num_tasks = 1
-      val sender1 = new JobVertex("Sender1")
-      val sender2 = new JobVertex("Sender2")
-      val receiver = new JobVertex("Receiver")
-
-      sender1.setInvokableClass(classOf[Sender])
-      sender2.setInvokableClass(classOf[Sender])
-      receiver.setInvokableClass(classOf[AgnosticTertiaryReceiver])
-
-      sender1.setParallelism(num_tasks)
-      sender2.setParallelism(2 * num_tasks)
-      receiver.setParallelism(3 * num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender1, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-      receiver.connectNewDataSetAsInput(sender2, DistributionPattern.ALL_TO_ALL,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Bipartite Job", sender1, receiver, sender2)
-
-      val cluster = TestingUtils.startTestingCluster(6 * num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "support two input job" in {
-      val num_tasks = 11
-      val sender1 = new JobVertex("Sender1")
-      val sender2 = new JobVertex("Sender2")
-      val receiver = new JobVertex("Receiver")
-
-      sender1.setInvokableClass(classOf[Sender])
-      sender2.setInvokableClass(classOf[Sender])
-      receiver.setInvokableClass(classOf[AgnosticBinaryReceiver])
-
-      sender1.setParallelism(num_tasks)
-      sender2.setParallelism(2 * num_tasks)
-      receiver.setParallelism(3 * num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender1, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-      receiver.connectNewDataSetAsInput(sender2, DistributionPattern.ALL_TO_ALL,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Bipartite Job", sender1, receiver, sender2)
-
-      val cluster = TestingUtils.startTestingCluster(6 * num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          expectMsgType[JobResultSuccess]
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "support scheduling all at once" in {
-      val num_tasks = 16
-      val sender = new JobVertex("Sender")
-      val forwarder = new JobVertex("Forwarder")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[Sender])
-      forwarder.setInvokableClass(classOf[Forwarder])
-      receiver.setInvokableClass(classOf[AgnosticReceiver])
-
-      sender.setParallelism(num_tasks)
-      forwarder.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      val sharingGroup = new SlotSharingGroup(sender.getID, receiver.getID)
-      sender.setSlotSharingGroup(sharingGroup)
-      forwarder.setSlotSharingGroup(sharingGroup)
-      receiver.setSlotSharingGroup(sharingGroup)
-
-      forwarder.connectNewDataSetAsInput(sender, DistributionPattern.ALL_TO_ALL,
-        ResultPartitionType.PIPELINED)
-      receiver.connectNewDataSetAsInput(forwarder, DistributionPattern.ALL_TO_ALL,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Forwarding Job", sender, forwarder, receiver)
-
-      jobGraph.setScheduleMode(ScheduleMode.EAGER)
-
-      val cluster = TestingUtils.startTestingCluster(num_tasks, 1)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          expectMsgType[JobResultSuccess]
-
-          jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-          expectMsg(true)
-        }
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "handle job with a failing sender vertex" in {
-      val num_tasks = 100
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[ExceptionSender])
-      receiver.setInvokableClass(classOf[Receiver])
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise Job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(RequestTotalNumberOfSlots, self)
-          expectMsg(num_tasks)
-        }
-
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "handle job with an occasionally failing sender vertex" in {
-      val num_tasks = 100
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[SometimesExceptionSender])
-      receiver.setInvokableClass(classOf[Receiver])
-
-      // set failing senders
-      SometimesExceptionSender.failingSenders = Seq.fill(10)(Random.nextInt(num_tasks)).toSet
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise Job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(RequestTotalNumberOfSlots, self)
-          expectMsg(num_tasks)
-        }
-
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "handle job with a failing receiver vertex" in {
-      val num_tasks = 200
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[Sender])
-      receiver.setInvokableClass(classOf[ExceptionReceiver])
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(2 * num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "handle job with all vertices failing during instantiation" in {
-      val num_tasks = 200
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[InstantiationErrorSender])
-      receiver.setInvokableClass(classOf[Receiver])
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(RequestTotalNumberOfSlots, self)
-          expectMsg(num_tasks)
-
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "handle job with some vertices failing during instantiation" in {
-      val num_tasks = 200
-      val sender = new JobVertex("Sender")
-      val receiver = new JobVertex("Receiver")
-
-      sender.setInvokableClass(classOf[SometimesInstantiationErrorSender])
-      receiver.setInvokableClass(classOf[Receiver])
-
-      // set the failing sender tasks
-      SometimesInstantiationErrorSender.failingSenders =
-        Seq.fill(10)(Random.nextInt(num_tasks)).toSet
-
-      sender.setParallelism(num_tasks)
-      receiver.setParallelism(num_tasks)
-
-      receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE,
-        ResultPartitionType.PIPELINED)
-
-      val jobGraph = new JobGraph("Pointwise job", sender, receiver)
-
-      val cluster = TestingUtils.startTestingCluster(num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try {
-        within(TestingUtils.TESTING_DURATION) {
-          jmGateway.tell(RequestTotalNumberOfSlots, self)
-          expectMsg(num_tasks)
-
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-
-          val failure = expectMsgType[JobResultFailure]
-          val exception = failure.cause.deserializeError(getClass.getClassLoader())
-          exception match {
-            case e: JobExecutionException =>
-              jobGraph.getJobID should equal(e.getJobID)
-
-            case e => fail(s"Received wrong exception $e.")
-          }
-        }
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally {
-        cluster.stop()
-      }
-    }
-
-    "check that all job vertices have completed the call to finalizeOnMaster before the job " +
-      "completes" in {
-      val num_tasks = 31
-
-      val source = new JobVertex("Source")
-      val sink = new WaitingOnFinalizeJobVertex("Sink", 500)
-
-      source.setInvokableClass(classOf[WaitingNoOpInvokable])
-      sink.setInvokableClass(classOf[NoOpInvokable])
-
-      source.setParallelism(num_tasks)
-      sink.setParallelism(num_tasks)
-
-      val jobGraph = new JobGraph("SubtaskInFinalStateRaceCondition", source, sink)
-
-      val cluster = TestingUtils.startTestingCluster(2*num_tasks)
-      val jmGateway = cluster.getLeaderGateway(1 seconds)
-
-      try{
-        within(TestingUtils.TESTING_DURATION){
-          jmGateway.tell(SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT), self)
-
-          expectMsg(JobSubmitSuccess(jobGraph.getJobID))
-          expectMsgType[JobResultSuccess]
-        }
-
-        sink.finished should equal(true)
-
-        jmGateway.tell(NotifyWhenJobRemoved(jobGraph.getJobID), self)
-        expectMsg(true)
-      } finally{
-        cluster.stop()
-      }
-    }
-
     "remove execution graphs when the client ends the session explicitly" in {
       val vertex = new JobVertex("Test Vertex")
       vertex.setInvokableClass(classOf[NoOpInvokable])
diff --git a/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/Tasks.scala b/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/Tasks.scala
index a5d9082..02458b8 100644
--- a/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/Tasks.scala
+++ b/flink-runtime/src/test/scala/org/apache/flink/runtime/jobmanager/Tasks.scala
@@ -24,7 +24,6 @@ import org.apache.flink.runtime.io.network.api.writer.RecordWriter
 import org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable
 import org.apache.flink.types.IntValue
 
-
 object Tasks {
 
   class Sender(environment: Environment)
@@ -197,24 +196,6 @@ object Tasks {
     }
   }
 
-  class SometimesExceptionSender(environment: Environment)
-    extends AbstractInvokable(environment) {
-
-    override def invoke(): Unit = {
-      // this only works if the TaskManager runs in the same JVM as the test case
-      if(SometimesExceptionSender.failingSenders.contains(this.getIndexInSubtaskGroup)){
-        throw new Exception("Test exception")
-      }else{
-        val o = new Object()
-        o.synchronized(o.wait())
-      }
-    }
-  }
-
-  object SometimesExceptionSender {
-    var failingSenders = Set[Int](0)
-  }
-
   class ExceptionReceiver(environment: Environment)
     extends AbstractInvokable(environment) {
 
@@ -231,24 +212,6 @@ object Tasks {
     }
   }
 
-  class SometimesInstantiationErrorSender(environment: Environment)
-    extends AbstractInvokable(environment) {
-
-    // this only works if the TaskManager runs in the same JVM as the test case
-    if(SometimesInstantiationErrorSender.failingSenders.contains(this.getIndexInSubtaskGroup)){
-      throw new RuntimeException("Test exception in constructor")
-    }
-
-    override def invoke(): Unit = {
-      val o = new Object()
-      o.synchronized(o.wait())
-    }
-  }
-
-  object SometimesInstantiationErrorSender {
-    var failingSenders = Set[Int](0)
-  }
-
   class BlockingReceiver(environment: Environment)
     extends AbstractInvokable(environment) {
     override def invoke(): Unit = {