protected void runAndCancelJob(Plan plan, final int msecsTillCanceling, int maxTimeTillCanceled) throws Exception { // submit job final JobGraph jobGraph = getJobGraph(plan); ClusterClient<?> client = CLUSTER.getClusterClient(); client.setDetached(true); JobSubmissionResult jobSubmissionResult = client.submitJob(jobGraph, CancelingTestBase.class.getClassLoader()); Deadline submissionDeadLine = new FiniteDuration(2, TimeUnit.MINUTES).fromNow(); JobStatus jobStatus = client.getJobStatus(jobSubmissionResult.getJobID()).get(GET_FUTURE_TIMEOUT, TimeUnit.MILLISECONDS); while (jobStatus != JobStatus.RUNNING && submissionDeadLine.hasTimeLeft()) { Thread.sleep(50); jobStatus = client.getJobStatus(jobSubmissionResult.getJobID()).get(GET_FUTURE_TIMEOUT, TimeUnit.MILLISECONDS); } if (jobStatus != JobStatus.RUNNING) { Assert.fail("Job not in state RUNNING."); } Thread.sleep(msecsTillCanceling); client.cancel(jobSubmissionResult.getJobID()); Deadline cancelDeadline = new FiniteDuration(maxTimeTillCanceled, TimeUnit.MILLISECONDS).fromNow(); JobStatus jobStatusAfterCancel = client.getJobStatus(jobSubmissionResult.getJobID()).get(GET_FUTURE_TIMEOUT, TimeUnit.MILLISECONDS); while (jobStatusAfterCancel != JobStatus.CANCELED && cancelDeadline.hasTimeLeft()) { Thread.sleep(50); jobStatusAfterCancel = client.getJobStatus(jobSubmissionResult.getJobID()).get(GET_FUTURE_TIMEOUT, TimeUnit.MILLISECONDS); } if (jobStatusAfterCancel != JobStatus.CANCELED) { Assert.fail("Failed to cancel job with ID " + jobSubmissionResult.getJobID() + '.'); } }
ClusterClient<?> clusterClient = new MiniClusterClient(new Configuration(), miniClusterResource.getMiniCluster()); Deadline deadline = new FiniteDuration(100, TimeUnit.SECONDS).fromNow();
new JavaTestKit(system) {{ final Deadline deadline = new FiniteDuration(3, TimeUnit.MINUTES).fromNow();
Deadline deadline = TEST_TIMEOUT.fromNow(); AtomicKvStateRequestStats stats = new AtomicKvStateRequestStats();
Deadline deadline = TEST_TIMEOUT.fromNow(); AtomicKvStateRequestStats stats = new AtomicKvStateRequestStats();
final Deadline deadline = testTimeout.fromNow();
Deadline deadline = TEST_TIMEOUT.fromNow(); AtomicKvStateRequestStats stats = new AtomicKvStateRequestStats();
Deadline deadline = TEST_TIMEOUT.fromNow(); AtomicKvStateRequestStats stats = new AtomicKvStateRequestStats();
Deadline deadline = TEST_TIMEOUT.fromNow(); AtomicKvStateRequestStats stats = new AtomicKvStateRequestStats();
final Deadline deadline = testTimeout.fromNow();
final Deadline deadline = TestTimeOut.fromNow();
Deadline deadline = timeout.$times(3).fromNow();
@RetryOnFailure(times = 1) public void testCheckpointRecoveryFailure() throws Exception { final Deadline testDeadline = TestTimeOut.fromNow(); final String zooKeeperQuorum = ZooKeeper.getConnectString(); final String fileStateBackendPath = temporaryFolder.newFolder().toString();
final Deadline deadline = new FiniteDuration(2, TimeUnit.MINUTES).fromNow();
/** * Awaits the leading job manager gateway and its web monitor port. */ public Tuple2<ActorGateway, Integer> awaitJobManagerGatewayAndWebPort() throws Exception { Future<Tuple2<ActorGateway, Integer>> gatewayPortFuture = null; Deadline deadline = timeout.fromNow(); while(!deadline.isOverdue()) { synchronized (waitLock) { gatewayPortFuture = leaderGatewayPortFuture; if (gatewayPortFuture != null) { break; } waitLock.wait(deadline.timeLeft().toMillis()); } } if (gatewayPortFuture == null) { throw new TimeoutException("There is no JobManager available."); } else { return Await.result(gatewayPortFuture, deadline.timeLeft()); } }
@Override public void apply(WorkStarted event) throws Exception { workState = workState.updated(event); log.info("Giving worker {} some work {}", workerId, event.workId); workers.put(workerId, state.copyWithStatus(new Busy(event.workId, workTimeout.fromNow()))); getSender().tell(work, getSelf()); } });