Java Code Examples for org.apache.flink.runtime.executiongraph.AccessExecutionGraph#getFailureInfo()

The following examples show how to use org.apache.flink.runtime.executiongraph.AccessExecutionGraph#getFailureInfo() . 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: JobResult.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the {@link JobResult} from the given {@link AccessExecutionGraph} which
 * must be in a globally terminal state.
 *
 * @param accessExecutionGraph to create the JobResult from
 * @return JobResult of the given AccessExecutionGraph
 */
public static JobResult createFrom(AccessExecutionGraph accessExecutionGraph) {
	final JobID jobId = accessExecutionGraph.getJobID();
	final JobStatus jobStatus = accessExecutionGraph.getState();

	checkArgument(
		jobStatus.isGloballyTerminalState(),
		"The job " + accessExecutionGraph.getJobName() + '(' + jobId + ") is not in a globally " +
			"terminal state. It is in state " + jobStatus + '.');

	final JobResult.Builder builder = new JobResult.Builder();
	builder.jobId(jobId);

	builder.applicationStatus(ApplicationStatus.fromJobStatus(accessExecutionGraph.getState()));

	final long netRuntime = accessExecutionGraph.getStatusTimestamp(jobStatus) - accessExecutionGraph.getStatusTimestamp(JobStatus.CREATED);
	// guard against clock changes
	final long guardedNetRuntime = Math.max(netRuntime, 0L);
	builder.netRuntime(guardedNetRuntime);
	builder.accumulatorResults(accessExecutionGraph.getAccumulatorsSerialized());

	if (jobStatus != JobStatus.FINISHED) {
		final ErrorInfo errorInfo = accessExecutionGraph.getFailureInfo();

		if (errorInfo != null) {
			builder.serializedThrowable(errorInfo.getException());
		}
	}

	return builder.build();
}
 
Example 2
Source File: JobExceptionsHandler.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static JobExceptionsInfo createJobExceptionsInfo(AccessExecutionGraph executionGraph) {
	ErrorInfo rootException = executionGraph.getFailureInfo();
	String rootExceptionMessage = null;
	Long rootTimestamp = null;
	if (rootException != null) {
		rootExceptionMessage = rootException.getExceptionAsString();
		rootTimestamp = rootException.getTimestamp();
	}

	List<JobExceptionsInfo.ExecutionExceptionInfo> taskExceptionList = new ArrayList<>();
	boolean truncated = false;
	for (AccessExecutionVertex task : executionGraph.getAllExecutionVertices()) {
		String t = task.getFailureCauseAsString();
		if (t != null && !t.equals(ExceptionUtils.STRINGIFIED_NULL_EXCEPTION)) {
			if (taskExceptionList.size() >= MAX_NUMBER_EXCEPTION_TO_REPORT) {
				truncated = true;
				break;
			}

			TaskManagerLocation location = task.getCurrentAssignedResourceLocation();
			String locationString = location != null ?
				location.getFQDNHostname() + ':' + location.dataPort() : "(unassigned)";
			long timestamp = task.getStateTimestamp(ExecutionState.FAILED);
			taskExceptionList.add(new JobExceptionsInfo.ExecutionExceptionInfo(
				t,
				task.getTaskNameWithSubtaskIndex(),
				locationString,
				timestamp == 0 ? -1 : timestamp));
		}
	}

	return new JobExceptionsInfo(rootExceptionMessage, rootTimestamp, taskExceptionList, truncated);
}
 
Example 3
Source File: JobResult.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the {@link JobResult} from the given {@link AccessExecutionGraph} which
 * must be in a globally terminal state.
 *
 * @param accessExecutionGraph to create the JobResult from
 * @return JobResult of the given AccessExecutionGraph
 */
public static JobResult createFrom(AccessExecutionGraph accessExecutionGraph) {
	final JobID jobId = accessExecutionGraph.getJobID();
	final JobStatus jobStatus = accessExecutionGraph.getState();

	checkArgument(
		jobStatus.isGloballyTerminalState(),
		"The job " + accessExecutionGraph.getJobName() + '(' + jobId + ") is not in a globally " +
			"terminal state. It is in state " + jobStatus + '.');

	final JobResult.Builder builder = new JobResult.Builder();
	builder.jobId(jobId);

	builder.applicationStatus(ApplicationStatus.fromJobStatus(accessExecutionGraph.getState()));

	final long netRuntime = accessExecutionGraph.getStatusTimestamp(jobStatus) - accessExecutionGraph.getStatusTimestamp(JobStatus.CREATED);
	// guard against clock changes
	final long guardedNetRuntime = Math.max(netRuntime, 0L);
	builder.netRuntime(guardedNetRuntime);
	builder.accumulatorResults(accessExecutionGraph.getAccumulatorsSerialized());

	if (jobStatus != JobStatus.FINISHED) {
		final ErrorInfo errorInfo = accessExecutionGraph.getFailureInfo();

		if (errorInfo != null) {
			builder.serializedThrowable(errorInfo.getException());
		}
	}

	return builder.build();
}
 
Example 4
Source File: JobExceptionsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobExceptionsInfo createJobExceptionsInfo(AccessExecutionGraph executionGraph) {
	ErrorInfo rootException = executionGraph.getFailureInfo();
	String rootExceptionMessage = null;
	Long rootTimestamp = null;
	if (rootException != null) {
		rootExceptionMessage = rootException.getExceptionAsString();
		rootTimestamp = rootException.getTimestamp();
	}

	List<JobExceptionsInfo.ExecutionExceptionInfo> taskExceptionList = new ArrayList<>();
	boolean truncated = false;
	for (AccessExecutionVertex task : executionGraph.getAllExecutionVertices()) {
		String t = task.getFailureCauseAsString();
		if (t != null && !t.equals(ExceptionUtils.STRINGIFIED_NULL_EXCEPTION)) {
			if (taskExceptionList.size() >= MAX_NUMBER_EXCEPTION_TO_REPORT) {
				truncated = true;
				break;
			}

			TaskManagerLocation location = task.getCurrentAssignedResourceLocation();
			String locationString = location != null ?
				location.getFQDNHostname() + ':' + location.dataPort() : "(unassigned)";
			long timestamp = task.getStateTimestamp(ExecutionState.FAILED);
			taskExceptionList.add(new JobExceptionsInfo.ExecutionExceptionInfo(
				t,
				task.getTaskNameWithSubtaskIndex(),
				locationString,
				timestamp == 0 ? -1 : timestamp));
		}
	}

	return new JobExceptionsInfo(rootExceptionMessage, rootTimestamp, taskExceptionList, truncated);
}
 
Example 5
Source File: JobResult.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the {@link JobResult} from the given {@link AccessExecutionGraph} which
 * must be in a globally terminal state.
 *
 * @param accessExecutionGraph to create the JobResult from
 * @return JobResult of the given AccessExecutionGraph
 */
public static JobResult createFrom(AccessExecutionGraph accessExecutionGraph) {
	final JobID jobId = accessExecutionGraph.getJobID();
	final JobStatus jobStatus = accessExecutionGraph.getState();

	checkArgument(
		jobStatus.isGloballyTerminalState(),
		"The job " + accessExecutionGraph.getJobName() + '(' + jobId + ") is not in a globally " +
			"terminal state. It is in state " + jobStatus + '.');

	final JobResult.Builder builder = new JobResult.Builder();
	builder.jobId(jobId);

	builder.applicationStatus(ApplicationStatus.fromJobStatus(accessExecutionGraph.getState()));

	final long netRuntime = accessExecutionGraph.getStatusTimestamp(jobStatus) - accessExecutionGraph.getStatusTimestamp(JobStatus.CREATED);
	// guard against clock changes
	final long guardedNetRuntime = Math.max(netRuntime, 0L);
	builder.netRuntime(guardedNetRuntime);
	builder.accumulatorResults(accessExecutionGraph.getAccumulatorsSerialized());

	if (jobStatus == JobStatus.FAILED) {
		final ErrorInfo errorInfo = accessExecutionGraph.getFailureInfo();
		checkNotNull(errorInfo, "No root cause is found for the job failure.");

		builder.serializedThrowable(errorInfo.getException());
	}

	return builder.build();
}
 
Example 6
Source File: JobExceptionsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
private static JobExceptionsInfo createJobExceptionsInfo(AccessExecutionGraph executionGraph, int exceptionToReportMaxSize) {
	ErrorInfo rootException = executionGraph.getFailureInfo();
	String rootExceptionMessage = null;
	Long rootTimestamp = null;
	if (rootException != null) {
		rootExceptionMessage = rootException.getExceptionAsString();
		rootTimestamp = rootException.getTimestamp();
	}

	List<JobExceptionsInfo.ExecutionExceptionInfo> taskExceptionList = new ArrayList<>();
	boolean truncated = false;
	for (AccessExecutionVertex task : executionGraph.getAllExecutionVertices()) {
		String t = task.getFailureCauseAsString();
		if (t != null && !t.equals(ExceptionUtils.STRINGIFIED_NULL_EXCEPTION)) {
			if (taskExceptionList.size() >= exceptionToReportMaxSize) {
				truncated = true;
				break;
			}

			TaskManagerLocation location = task.getCurrentAssignedResourceLocation();
			String locationString = location != null ?
				location.getFQDNHostname() + ':' + location.dataPort() : "(unassigned)";
			long timestamp = task.getStateTimestamp(ExecutionState.FAILED);
			taskExceptionList.add(new JobExceptionsInfo.ExecutionExceptionInfo(
				t,
				task.getTaskNameWithSubtaskIndex(),
				locationString,
				timestamp == 0 ? -1 : timestamp));
		}
	}

	return new JobExceptionsInfo(rootExceptionMessage, rootTimestamp, taskExceptionList, truncated);
}