Search in sources :

Example 1 with AttachToJobAndWait

use of org.apache.flink.runtime.messages.JobClientMessages.AttachToJobAndWait in project flink by apache.

the class JobClientActorTest method testConnectionTimeoutAfterJobRegistration.

/** Tests that a {@link JobClientActorConnectionTimeoutException}
	 * is thrown after a successful registration of the client at the JobManager.
	 */
@Test(expected = JobClientActorConnectionTimeoutException.class)
public void testConnectionTimeoutAfterJobRegistration() throws Exception {
    FiniteDuration jobClientActorTimeout = new FiniteDuration(5, TimeUnit.SECONDS);
    FiniteDuration timeout = jobClientActorTimeout.$times(2);
    UUID leaderSessionID = UUID.randomUUID();
    ActorRef jobManager = system.actorOf(Props.create(JobAcceptingActor.class, leaderSessionID));
    TestingLeaderRetrievalService testingLeaderRetrievalService = new TestingLeaderRetrievalService(jobManager.path().toString(), leaderSessionID);
    Props jobClientActorProps = JobAttachmentClientActor.createActorProps(testingLeaderRetrievalService, jobClientActorTimeout, false);
    ActorRef jobClientActor = system.actorOf(jobClientActorProps);
    Future<Object> jobExecutionResult = Patterns.ask(jobClientActor, new AttachToJobAndWait(testJobGraph.getJobID()), new Timeout(timeout));
    Future<Object> waitFuture = Patterns.ask(jobManager, new RegisterTest(), new Timeout(timeout));
    Await.result(waitFuture, timeout);
    jobManager.tell(PoisonPill.getInstance(), ActorRef.noSender());
    Await.result(jobExecutionResult, timeout);
}
Also used : TestingLeaderRetrievalService(org.apache.flink.runtime.leaderelection.TestingLeaderRetrievalService) ActorRef(akka.actor.ActorRef) Timeout(akka.util.Timeout) FiniteDuration(scala.concurrent.duration.FiniteDuration) UUID(java.util.UUID) Props(akka.actor.Props) AttachToJobAndWait(org.apache.flink.runtime.messages.JobClientMessages.AttachToJobAndWait) Test(org.junit.Test)

Aggregations

ActorRef (akka.actor.ActorRef)1 Props (akka.actor.Props)1 Timeout (akka.util.Timeout)1 UUID (java.util.UUID)1 TestingLeaderRetrievalService (org.apache.flink.runtime.leaderelection.TestingLeaderRetrievalService)1 AttachToJobAndWait (org.apache.flink.runtime.messages.JobClientMessages.AttachToJobAndWait)1 Test (org.junit.Test)1 FiniteDuration (scala.concurrent.duration.FiniteDuration)1