org.apache.flink.runtime.messages.webmonitor.RequestJobDetails Java Examples

The following examples show how to use org.apache.flink.runtime.messages.webmonitor.RequestJobDetails. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebMonitorMessagesTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testStatusMessages() {
	try {
		final Random rnd = new Random();
		
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsWithIDsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestStatusOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());

		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(RequestJobDetails.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(ClusterOverview.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(JobsOverview.class, rnd));
		
		GenericMessageTester.testMessageInstance(new JobIdsWithStatusOverview(Arrays.asList(
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RUNNING),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CANCELED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CREATED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.FAILED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RESTARTING))));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #2
Source File: ClusterClient.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Lists the currently running and finished jobs on the cluster.
 *
 * @return future collection of running and finished jobs
 * @throws Exception if no connection to the cluster could be established
 */
public CompletableFuture<Collection<JobStatusMessage>> listJobs() throws Exception {
	final ActorGateway jobManager = getJobManagerGateway();

	Future<Object> response = jobManager.ask(new RequestJobDetails(true, false), timeout);
	CompletableFuture<Object> responseFuture = FutureUtils.toJava(response);

	return responseFuture.thenApply((responseMessage) -> {
		if (responseMessage instanceof MultipleJobsDetails) {
			MultipleJobsDetails details = (MultipleJobsDetails) responseMessage;

			final Collection<JobDetails> jobDetails = details.getJobs();
			Collection<JobStatusMessage> flattenedDetails = new ArrayList<>(jobDetails.size());
			jobDetails.forEach(detail -> flattenedDetails.add(new JobStatusMessage(detail.getJobId(), detail.getJobName(), detail.getStatus(), detail.getStartTime())));
			return flattenedDetails;
		} else {
			throw new CompletionException(
				new IllegalStateException("Unknown JobManager response of type " + responseMessage.getClass()));
		}
	});
}
 
Example #3
Source File: WebMonitorMessagesTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStatusMessages() {
	try {
		final Random rnd = new Random();
		
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsWithIDsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestStatusOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());

		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(RequestJobDetails.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(ClusterOverview.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(JobsOverview.class, rnd));
		
		GenericMessageTester.testMessageInstance(new JobIdsWithStatusOverview(Arrays.asList(
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RUNNING),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CANCELED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CREATED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.FAILED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RESTARTING))));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
Example #4
Source File: WebMonitorMessagesTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStatusMessages() {
	try {
		final Random rnd = new Random();
		
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsWithIDsOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestStatusOverview.getInstance());
		GenericMessageTester.testMessageInstance(RequestJobsOverview.getInstance());

		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(RequestJobDetails.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(ClusterOverview.class, rnd));
		GenericMessageTester.testMessageInstance(GenericMessageTester.instantiateGeneric(JobsOverview.class, rnd));
		
		GenericMessageTester.testMessageInstance(new JobIdsWithStatusOverview(Arrays.asList(
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RUNNING),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CANCELED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.CREATED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.FAILED),
			new JobIdsWithStatusOverview.JobIdWithStatus(JobID.generate(), JobStatus.RESTARTING))));
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}