Github user mjsax commented on a diff in the pull request:
https://github.com/apache/flink/pull/750#discussion_r46290465
--- 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 --
This might end up in a race condition. STOP only sets a flag to the sources
that they should return from `run()` -- however, the job itself is still in
state `RUNNING` before this happens, thus it will not be removed from
`currentJobs` until the sources (actually the whole job) finished. If we check
too early this test fails. I would rather leave it as is -- otherwise, we
introduce an instability to this test. Let me know if you disagree.
---
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.
---