use of akka.util.Timeout in project flink by apache.
the class JobClientActorTest method testRegistrationTimeout.
/** Tests that a {@link JobClientActorRegistrationTimeoutException} is thrown when the registration
* cannot be performed at the JobManager by the JobAttachmentClientActor. This is here the case, because the
* started JobManager never replies to a {@link RegisterJobClient} message.
*/
@Test(expected = JobClientActorRegistrationTimeoutException.class)
public void testRegistrationTimeout() throws Exception {
FiniteDuration jobClientActorTimeout = new FiniteDuration(5, TimeUnit.SECONDS);
FiniteDuration timeout = jobClientActorTimeout.$times(2);
UUID leaderSessionID = UUID.randomUUID();
ActorRef jobManager = system.actorOf(Props.create(PlainActor.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 JobClientMessages.AttachToJobAndWait(testJobGraph.getJobID()), new Timeout(timeout));
Await.result(jobExecutionResult, timeout);
}
use of akka.util.Timeout in project flink by apache.
the class JobClientActorTest method testConnectionTimeoutWithoutJobManagerForRegistration.
/** Tests that a {@link org.apache.flink.runtime.client.JobClientActorConnectionTimeoutException}
* is thrown when the JobAttachmentClientActor attach to a job at the JobManager
* but has not connected to a JobManager.
*/
@Test(expected = JobClientActorConnectionTimeoutException.class)
public void testConnectionTimeoutWithoutJobManagerForRegistration() throws Exception {
FiniteDuration jobClientActorTimeout = new FiniteDuration(5, TimeUnit.SECONDS);
FiniteDuration timeout = jobClientActorTimeout.$times(2);
TestingLeaderRetrievalService testingLeaderRetrievalService = new TestingLeaderRetrievalService();
Props jobClientActorProps = JobAttachmentClientActor.createActorProps(testingLeaderRetrievalService, jobClientActorTimeout, false);
ActorRef jobClientActor = system.actorOf(jobClientActorProps);
Future<Object> jobExecutionResult = Patterns.ask(jobClientActor, new JobClientMessages.AttachToJobAndWait(testJobGraph.getJobID()), new Timeout(timeout));
Await.result(jobExecutionResult, timeout);
}
use of akka.util.Timeout 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);
}
use of akka.util.Timeout in project flink by apache.
the class JobClientActorTest method testGuaranteedAnswerIfJobClientDies.
/** Tests that JobClient throws an Exception if the JobClientActor dies and can't answer to
* {@link akka.actor.Identify} message anymore.
*/
@Test
public void testGuaranteedAnswerIfJobClientDies() throws Exception {
FiniteDuration timeout = new FiniteDuration(2, TimeUnit.SECONDS);
UUID leaderSessionID = UUID.randomUUID();
ActorRef jobManager = system.actorOf(Props.create(JobAcceptingActor.class, leaderSessionID));
TestingLeaderRetrievalService testingLeaderRetrievalService = new TestingLeaderRetrievalService(jobManager.path().toString(), leaderSessionID);
JobListeningContext jobListeningContext = JobClient.submitJob(system, clientConfig, testingLeaderRetrievalService, testJobGraph, timeout, false, getClass().getClassLoader());
Future<Object> waitFuture = Patterns.ask(jobManager, new RegisterTest(), new Timeout(timeout));
Await.result(waitFuture, timeout);
// kill the job client actor which has been registered at the JobManager
jobListeningContext.getJobClientActor().tell(PoisonPill.getInstance(), ActorRef.noSender());
try {
// should not block but return an error
JobClient.awaitJobResult(jobListeningContext);
Assert.fail();
} catch (JobExecutionException e) {
// this is what we want
}
}
use of akka.util.Timeout in project flink by apache.
the class JobClientActorTest method testConnectionTimeoutWithoutJobManagerForSubmission.
/** Tests that a {@link org.apache.flink.runtime.client.JobClientActorConnectionTimeoutException}
* is thrown when the JobSubmissionClientActor wants to submit a job but has not connected to a JobManager.
*
* @throws Exception
*/
@Test(expected = JobClientActorConnectionTimeoutException.class)
public void testConnectionTimeoutWithoutJobManagerForSubmission() throws Exception {
FiniteDuration jobClientActorTimeout = new FiniteDuration(5, TimeUnit.SECONDS);
FiniteDuration timeout = jobClientActorTimeout.$times(2);
TestingLeaderRetrievalService testingLeaderRetrievalService = new TestingLeaderRetrievalService();
Props jobClientActorProps = JobSubmissionClientActor.createActorProps(testingLeaderRetrievalService, jobClientActorTimeout, false, clientConfig);
ActorRef jobClientActor = system.actorOf(jobClientActorProps);
Future<Object> jobExecutionResult = Patterns.ask(jobClientActor, new JobClientMessages.SubmitJobAndWait(testJobGraph), new Timeout(timeout));
Await.result(jobExecutionResult, timeout);
}
Aggregations