Search in sources :

Example 1 with ClusterOverview

use of org.apache.flink.runtime.messages.webmonitor.ClusterOverview in project flink by apache.

the class Dispatcher method requestClusterOverview.

@Override
public CompletableFuture<ClusterOverview> requestClusterOverview(Time timeout) {
    CompletableFuture<ResourceOverview> taskManagerOverviewFuture = runResourceManagerCommand(resourceManagerGateway -> resourceManagerGateway.requestResourceOverview(timeout));
    final List<CompletableFuture<Optional<JobStatus>>> optionalJobInformation = queryJobMastersForInformation(jobManagerRunner -> jobManagerRunner.requestJobStatus(timeout));
    CompletableFuture<Collection<Optional<JobStatus>>> allOptionalJobsFuture = FutureUtils.combineAll(optionalJobInformation);
    CompletableFuture<Collection<JobStatus>> allJobsFuture = allOptionalJobsFuture.thenApply(this::flattenOptionalCollection);
    final JobsOverview completedJobsOverview = executionGraphInfoStore.getStoredJobsOverview();
    return allJobsFuture.thenCombine(taskManagerOverviewFuture, (Collection<JobStatus> runningJobsStatus, ResourceOverview resourceOverview) -> {
        final JobsOverview allJobsOverview = JobsOverview.create(runningJobsStatus).combine(completedJobsOverview);
        return new ClusterOverview(resourceOverview, allJobsOverview);
    });
}
Also used : JobStatus(org.apache.flink.api.common.JobStatus) CompletableFuture(java.util.concurrent.CompletableFuture) ClusterOverview(org.apache.flink.runtime.messages.webmonitor.ClusterOverview) Collection(java.util.Collection) ResourceOverview(org.apache.flink.runtime.resourcemanager.ResourceOverview) JobsOverview(org.apache.flink.runtime.messages.webmonitor.JobsOverview)

Aggregations

Collection (java.util.Collection)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 JobStatus (org.apache.flink.api.common.JobStatus)1 ClusterOverview (org.apache.flink.runtime.messages.webmonitor.ClusterOverview)1 JobsOverview (org.apache.flink.runtime.messages.webmonitor.JobsOverview)1 ResourceOverview (org.apache.flink.runtime.resourcemanager.ResourceOverview)1