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

The following examples show how to use org.apache.flink.runtime.messages.webmonitor.JobsOverview. 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: Dispatcher.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<ClusterOverview> requestClusterOverview(Time timeout) {
	CompletableFuture<ResourceOverview> taskManagerOverviewFuture = runResourceManagerCommand(resourceManagerGateway -> resourceManagerGateway.requestResourceOverview(timeout));

	final List<CompletableFuture<Optional<JobStatus>>> optionalJobInformation = queryJobMastersForInformation(
		(JobMasterGateway jobMasterGateway) -> jobMasterGateway.requestJobStatus(timeout));

	CompletableFuture<Collection<Optional<JobStatus>>> allOptionalJobsFuture = FutureUtils.combineAll(optionalJobInformation);

	CompletableFuture<Collection<JobStatus>> allJobsFuture = allOptionalJobsFuture.thenApply(this::flattenOptionalCollection);

	final JobsOverview completedJobsOverview = archivedExecutionGraphStore.getStoredJobsOverview();

	return allJobsFuture.thenCombine(
		taskManagerOverviewFuture,
		(Collection<JobStatus> runningJobsStatus, ResourceOverview resourceOverview) -> {
			final JobsOverview allJobsOverview = JobsOverview.create(runningJobsStatus).combine(completedJobsOverview);
			return new ClusterOverview(resourceOverview, allJobsOverview);
		});
}
 
Example #2
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 #3
Source File: FileArchivedExecutionGraphStoreTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that we obtain the correct jobs overview.
 */
@Test
public void testStoredJobsOverview() throws IOException {
	final int numberExecutionGraphs = 10;
	final Collection<ArchivedExecutionGraph> executionGraphs = generateTerminalExecutionGraphs(numberExecutionGraphs);

	final List<JobStatus> jobStatuses = executionGraphs.stream().map(ArchivedExecutionGraph::getState).collect(Collectors.toList());

	final JobsOverview expectedJobsOverview = JobsOverview.create(jobStatuses);

	final File rootDir = temporaryFolder.newFolder();

	try (final FileArchivedExecutionGraphStore executionGraphStore = createDefaultExecutionGraphStore(rootDir)) {
		for (ArchivedExecutionGraph executionGraph : executionGraphs) {
			executionGraphStore.put(executionGraph);
		}

		assertThat(executionGraphStore.getStoredJobsOverview(), Matchers.equalTo(expectedJobsOverview));
	}
}
 
Example #4
Source File: Dispatcher.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<ClusterOverview> requestClusterOverview(Time timeout) {
	CompletableFuture<ResourceOverview> taskManagerOverviewFuture = runResourceManagerCommand(resourceManagerGateway -> resourceManagerGateway.requestResourceOverview(timeout));

	final List<CompletableFuture<Optional<JobStatus>>> optionalJobInformation = queryJobMastersForInformation(
		(JobMasterGateway jobMasterGateway) -> jobMasterGateway.requestJobStatus(timeout));

	CompletableFuture<Collection<Optional<JobStatus>>> allOptionalJobsFuture = FutureUtils.combineAll(optionalJobInformation);

	CompletableFuture<Collection<JobStatus>> allJobsFuture = allOptionalJobsFuture.thenApply(this::flattenOptionalCollection);

	final JobsOverview completedJobsOverview = archivedExecutionGraphStore.getStoredJobsOverview();

	return allJobsFuture.thenCombine(
		taskManagerOverviewFuture,
		(Collection<JobStatus> runningJobsStatus, ResourceOverview resourceOverview) -> {
			final JobsOverview allJobsOverview = JobsOverview.create(runningJobsStatus).combine(completedJobsOverview);
			return new ClusterOverview(resourceOverview, allJobsOverview);
		});
}
 
Example #5
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 #6
Source File: FileArchivedExecutionGraphStoreTest.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that we obtain the correct jobs overview.
 */
@Test
public void testStoredJobsOverview() throws IOException {
	final int numberExecutionGraphs = 10;
	final Collection<ArchivedExecutionGraph> executionGraphs = generateTerminalExecutionGraphs(numberExecutionGraphs);

	final List<JobStatus> jobStatuses = executionGraphs.stream().map(ArchivedExecutionGraph::getState).collect(Collectors.toList());

	final JobsOverview expectedJobsOverview = JobsOverview.create(jobStatuses);

	final File rootDir = temporaryFolder.newFolder();

	try (final FileArchivedExecutionGraphStore executionGraphStore = createDefaultExecutionGraphStore(rootDir)) {
		for (ArchivedExecutionGraph executionGraph : executionGraphs) {
			executionGraphStore.put(executionGraph);
		}

		assertThat(executionGraphStore.getStoredJobsOverview(), Matchers.equalTo(expectedJobsOverview));
	}
}
 
Example #7
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 #8
Source File: FileArchivedExecutionGraphStoreTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that we obtain the correct jobs overview.
 */
@Test
public void testStoredJobsOverview() throws IOException {
	final int numberExecutionGraphs = 10;
	final Collection<ArchivedExecutionGraph> executionGraphs = generateTerminalExecutionGraphs(numberExecutionGraphs);

	final List<JobStatus> jobStatuses = executionGraphs.stream().map(ArchivedExecutionGraph::getState).collect(Collectors.toList());

	final JobsOverview expectedJobsOverview = JobsOverview.create(jobStatuses);

	final File rootDir = temporaryFolder.newFolder();

	try (final FileArchivedExecutionGraphStore executionGraphStore = createDefaultExecutionGraphStore(rootDir)) {
		for (ArchivedExecutionGraph executionGraph : executionGraphs) {
			executionGraphStore.put(executionGraph);
		}

		assertThat(executionGraphStore.getStoredJobsOverview(), Matchers.equalTo(expectedJobsOverview));
	}
}
 
Example #9
Source File: Dispatcher.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public CompletableFuture<ClusterOverview> requestClusterOverview(Time timeout) {
	CompletableFuture<ResourceOverview> taskManagerOverviewFuture = runResourceManagerCommand(resourceManagerGateway -> resourceManagerGateway.requestResourceOverview(timeout));

	final List<CompletableFuture<Optional<JobStatus>>> optionalJobInformation = queryJobMastersForInformation(
		(JobMasterGateway jobMasterGateway) -> jobMasterGateway.requestJobStatus(timeout));

	CompletableFuture<Collection<Optional<JobStatus>>> allOptionalJobsFuture = FutureUtils.combineAll(optionalJobInformation);

	CompletableFuture<Collection<JobStatus>> allJobsFuture = allOptionalJobsFuture.thenApply(this::flattenOptionalCollection);

	final JobsOverview completedJobsOverview = archivedExecutionGraphStore.getStoredJobsOverview();

	return allJobsFuture.thenCombine(
		taskManagerOverviewFuture,
		(Collection<JobStatus> runningJobsStatus, ResourceOverview resourceOverview) -> {
			final JobsOverview allJobsOverview = JobsOverview.create(runningJobsStatus).combine(completedJobsOverview);
			return new ClusterOverview(resourceOverview, allJobsOverview);
		});
}
 
Example #10
Source File: MemoryArchivedExecutionGraphStore.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	Collection<JobStatus> allJobStatus = serializableExecutionGraphs.values().stream()
		.map(ArchivedExecutionGraph::getState)
		.collect(Collectors.toList());

	return JobsOverview.create(allJobStatus);
}
 
Example #11
Source File: MemoryArchivedExecutionGraphStore.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	Collection<JobStatus> allJobStatus = serializableExecutionGraphs.values().stream()
		.map(ArchivedExecutionGraph::getState)
		.collect(Collectors.toList());

	return JobsOverview.create(allJobStatus);
}
 
Example #12
Source File: ClusterOverviewWithVersion.java    From flink with Apache License 2.0 5 votes vote down vote up
public ClusterOverviewWithVersion(
		int numTaskManagersConnected,
		int numSlotsTotal,
		int numSlotsAvailable,
		JobsOverview jobs1,
		JobsOverview jobs2,
		String version,
		String commitId) {
	super(numTaskManagersConnected, numSlotsTotal, numSlotsAvailable, jobs1, jobs2);

	this.version = Preconditions.checkNotNull(version);
	this.commitId = Preconditions.checkNotNull(commitId);
}
 
Example #13
Source File: ClusterOverviewWithVersion.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public ClusterOverviewWithVersion(
		int numTaskManagersConnected,
		int numSlotsTotal,
		int numSlotsAvailable,
		JobsOverview jobs1,
		JobsOverview jobs2,
		String version,
		String commitId) {
	super(numTaskManagersConnected, numSlotsTotal, numSlotsAvailable, jobs1, jobs2);

	this.version = Preconditions.checkNotNull(version);
	this.commitId = Preconditions.checkNotNull(commitId);
}
 
Example #14
Source File: MemoryArchivedExecutionGraphStore.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	Collection<JobStatus> allJobStatus = serializableExecutionGraphs.values().stream()
		.map(ArchivedExecutionGraph::getState)
		.collect(Collectors.toList());

	return JobsOverview.create(allJobStatus);
}
 
Example #15
Source File: ClusterOverviewWithVersion.java    From flink with Apache License 2.0 5 votes vote down vote up
public ClusterOverviewWithVersion(
		int numTaskManagersConnected,
		int numSlotsTotal,
		int numSlotsAvailable,
		JobsOverview jobs1,
		JobsOverview jobs2,
		String version,
		String commitId) {
	super(numTaskManagersConnected, numSlotsTotal, numSlotsAvailable, jobs1, jobs2);

	this.version = Preconditions.checkNotNull(version);
	this.commitId = Preconditions.checkNotNull(commitId);
}
 
Example #16
Source File: FileArchivedExecutionGraphStore.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	return new JobsOverview(0, numFinishedJobs, numCanceledJobs, numFailedJobs);
}
 
Example #17
Source File: FileArchivedExecutionGraphStore.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	return new JobsOverview(0, numFinishedJobs, numCanceledJobs, numFailedJobs);
}
 
Example #18
Source File: FileArchivedExecutionGraphStore.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public JobsOverview getStoredJobsOverview() {
	return new JobsOverview(0, numFinishedJobs, numCanceledJobs, numFailedJobs);
}
 
Example #19
Source File: ArchivedExecutionGraphStore.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Return the {@link JobsOverview} for all stored/past jobs.
 *
 * @return Jobs overview for all stored/past jobs
 */
JobsOverview getStoredJobsOverview();
 
Example #20
Source File: ArchivedExecutionGraphStore.java    From flink with Apache License 2.0 2 votes vote down vote up
/**
 * Return the {@link JobsOverview} for all stored/past jobs.
 *
 * @return Jobs overview for all stored/past jobs
 */
JobsOverview getStoredJobsOverview();
 
Example #21
Source File: ArchivedExecutionGraphStore.java    From Flink-CEPplus with Apache License 2.0 2 votes vote down vote up
/**
 * Return the {@link JobsOverview} for all stored/past jobs.
 *
 * @return Jobs overview for all stored/past jobs
 */
JobsOverview getStoredJobsOverview();