Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/750#discussion_r46670412
--- Diff:
flink-runtime/src/test/java/org/apache/flink/runtime/jobmanager/JobManagerTest.java
---
@@ -227,4 +235,121 @@ public void testRequestPartitionState() throws
Exception {
}
}};
}
+
+ @Test
+ public void testStopSignal() throws Exception {
+ new JavaTestKit(system) {{
+ // Setup
+ TestingCluster cluster = null;
+
+ try {
+ cluster = startTestingCluster(2, 1,
DEFAULT_AKKA_ASK_TIMEOUT());
+
+ // Create a task
+ final JobVertex sender = new
JobVertex("Sender");
+ sender.setParallelism(2);
+
sender.setInvokableClass(StoppableInvokable.class);
+
+ final JobGraph jobGraph = new
JobGraph("Blocking test job", JobType.STREAMING, sender);
+ final JobID jid = jobGraph.getJobID();
+
+ final ActorGateway jobManagerGateway =
cluster.getLeaderGateway(TestingUtils.TESTING_DURATION());
+
+ // we can set the leader session ID to None
because we don't use this gateway to send messages
+ final ActorGateway testActorGateway = new
AkkaActorGateway(getTestActor(), null);
+
+ // Submit the job and wait for all vertices to
be running
+ jobManagerGateway.tell(
+ new SubmitJob(
+ jobGraph,
+
ListeningBehaviour.EXECUTION_RESULT),
+ testActorGateway);
+
expectMsgClass(JobManagerMessages.JobSubmitSuccess.class);
+
+ jobManagerGateway.tell(new StopJob(jid),
testActorGateway);
+
+ // - The test
----------------------------------------------------------------------
+ expectMsgClass(StoppingSuccess.class);
--- End diff --
The problem is that `StoppableInvokable` is not instantiatable. Thus the
stop signal does not stop anything because the tasks go directly into the state
Failed. Furthermore, I noticed that we don't need the `NotifyWhenJobRemoved`
message because we can wait for the `JobResultSuccess` message. I've fixed the
test and opened a PR against your branch.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---