org.apache.flink.runtime.rest.messages.job.JobDetailsInfo Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.job.JobDetailsInfo. 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: JobDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public JobDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobDetailsInfo, JobMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor,
		MetricFetcher metricFetcher) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
}
 
Example #2
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
public JobDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobDetailsInfo, JobMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor,
		MetricFetcher metricFetcher) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
}
 
Example #3
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
public JobDetailsHandler(
		GatewayRetriever<? extends RestfulGateway> leaderRetriever,
		Time timeout,
		Map<String, String> responseHeaders,
		MessageHeaders<EmptyRequestBody, JobDetailsInfo, JobMessageParameters> messageHeaders,
		ExecutionGraphCache executionGraphCache,
		Executor executor,
		MetricFetcher metricFetcher) {
	super(
		leaderRetriever,
		timeout,
		responseHeaders,
		messageHeaders,
		executionGraphCache,
		executor);

	this.metricFetcher = Preconditions.checkNotNull(metricFetcher);
}
 
Example #4
Source File: YARNHighAvailabilityITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void waitUntilJobIsRunning(RestClusterClient<ApplicationId> restClusterClient, JobID jobId) throws Exception {
	CommonTestUtils.waitUntilCondition(
		() -> {
			final JobDetailsInfo jobDetails = restClusterClient.getJobDetails(jobId).get();
			return jobDetails.getJobVertexInfos()
				.stream()
				.map(toExecutionState())
				.allMatch(isRunning());
		},
		Deadline.fromNow(TIMEOUT));
}
 
Example #5
Source File: RestClusterClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Requests the job details.
 *
 * @param jobId The job id
 * @return Job details
 */
public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
	final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance();
	final JobMessageParameters  params = new JobMessageParameters();
	params.jobPathParameter.resolve(jobId);

	return sendRequest(
		detailsHeaders,
		params);
}
 
Example #6
Source File: YARNHighAvailabilityITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static void waitUntilJobIsRunning(RestClusterClient<ApplicationId> restClusterClient, JobID jobId) throws Exception {
	CommonTestUtils.waitUntilCondition(
		() -> {
			final JobDetailsInfo jobDetails = restClusterClient.getJobDetails(jobId).get();
			return jobDetails.getJobVertexInfos()
				.stream()
				.map(toExecutionState())
				.allMatch(isRunning());
		},
		Deadline.fromNow(TIMEOUT));
}
 
Example #7
Source File: RestClusterClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Requests the job details.
 *
 * @param jobId The job id
 * @return Job details
 */
public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
	final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance();
	final JobMessageParameters  params = new JobMessageParameters();
	params.jobPathParameter.resolve(jobId);

	return sendRequest(
		detailsHeaders,
		params);
}
 
Example #8
Source File: RestClusterClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Requests the job details.
 *
 * @param jobId The job id
 * @return Job details
 */
public CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
	final JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance();
	final JobMessageParameters  params = new JobMessageParameters();
	params.jobPathParameter.resolve(jobId);

	return sendRequest(
		detailsHeaders,
		params);
}
 
Example #9
Source File: YARNHighAvailabilityITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private static void waitUntilJobIsRunning(RestClusterClient<ApplicationId> restClusterClient, JobID jobId) throws Exception {
	CommonTestUtils.waitUntilCondition(
		() -> {
			final JobDetailsInfo jobDetails = restClusterClient.getJobDetails(jobId).get();
			return jobDetails.getJobVertexInfos()
				.stream()
				.map(toExecutionState())
				.allMatch(isRunning());
		},
		Deadline.fromNow(TIMEOUT));
}
 
Example #10
Source File: YARNHighAvailabilityITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private static Function<JobDetailsInfo.JobVertexDetailsInfo, ExecutionState> toExecutionState() {
	return JobDetailsInfo.JobVertexDetailsInfo::getExecutionState;
}
 
Example #11
Source File: RestClusterClient.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<JobStatus> getJobStatus(JobID jobId) {
	return getJobDetails(jobId).thenApply(JobDetailsInfo::getJobStatus);
}
 
Example #12
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}
 
Example #13
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected JobDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	return createJobDetailsInfo(executionGraph, metricFetcher);
}
 
Example #14
Source File: BatchFineGrainedRecoveryITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
	JobMessageParameters params = new JobMessageParameters();
	params.jobPathParameter.resolve(jobId);
	return sendRequest(JobDetailsHeaders.getInstance(), params);
}
 
Example #15
Source File: YARNHighAvailabilityITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private static Function<JobDetailsInfo.JobVertexDetailsInfo, ExecutionState> toExecutionState() {
	return JobDetailsInfo.JobVertexDetailsInfo::getExecutionState;
}
 
Example #16
Source File: RestClusterClient.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<JobStatus> getJobStatus(JobID jobId) {
	return getJobDetails(jobId).thenApply(JobDetailsInfo::getJobStatus);
}
 
Example #17
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}
 
Example #18
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected JobDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	return createJobDetailsInfo(executionGraph, metricFetcher);
}
 
Example #19
Source File: BatchFineGrainedRecoveryITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private CompletableFuture<JobDetailsInfo> getJobDetails(JobID jobId) {
	JobMessageParameters params = new JobMessageParameters();
	params.jobPathParameter.resolve(jobId);
	return sendRequest(JobDetailsHeaders.getInstance(), params);
}
 
Example #20
Source File: YARNHighAvailabilityITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static Function<JobDetailsInfo.JobVertexDetailsInfo, ExecutionState> toExecutionState() {
	return JobDetailsInfo.JobVertexDetailsInfo::getExecutionState;
}
 
Example #21
Source File: RestClusterClient.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public CompletableFuture<JobStatus> getJobStatus(JobID jobId) {
	return getJobDetails(jobId).thenApply(JobDetailsInfo::getJobStatus);
}
 
Example #22
Source File: JobDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}
 
Example #23
Source File: JobDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected JobDetailsInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	return createJobDetailsInfo(executionGraph, metricFetcher);
}