Java Code Examples for org.apache.flink.runtime.executiongraph.AccessExecution#getAttemptNumber()
The following examples show how to use
org.apache.flink.runtime.executiongraph.AccessExecution#getAttemptNumber() .
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: AbstractSubtaskAttemptHandler.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionVertex executionVertex) throws RestHandlerException { final Integer attemptNumber = request.getPathParameter(SubtaskAttemptPathParameter.class); final AccessExecution currentAttempt = executionVertex.getCurrentExecutionAttempt(); if (attemptNumber == currentAttempt.getAttemptNumber()) { return handleRequest(request, currentAttempt); } else if (attemptNumber >= 0 && attemptNumber < currentAttempt.getAttemptNumber()) { final AccessExecution execution = executionVertex.getPriorExecutionAttempt(attemptNumber); if (execution != null) { return handleRequest(request, execution); } else { throw new RestHandlerException("Attempt " + attemptNumber + " not found in subtask " + executionVertex.getTaskNameWithSubtaskIndex(), HttpResponseStatus.NOT_FOUND); } } else { throw new RestHandlerException("Invalid attempt num " + attemptNumber, HttpResponseStatus.NOT_FOUND); } }
Example 2
Source File: AbstractSubtaskAttemptHandler.java From flink with Apache License 2.0 | 6 votes |
@Override protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionVertex executionVertex) throws RestHandlerException { final Integer attemptNumber = request.getPathParameter(SubtaskAttemptPathParameter.class); final AccessExecution currentAttempt = executionVertex.getCurrentExecutionAttempt(); if (attemptNumber == currentAttempt.getAttemptNumber()) { return handleRequest(request, currentAttempt); } else if (attemptNumber >= 0 && attemptNumber < currentAttempt.getAttemptNumber()) { final AccessExecution execution = executionVertex.getPriorExecutionAttempt(attemptNumber); if (execution != null) { return handleRequest(request, execution); } else { throw new RestHandlerException("Attempt " + attemptNumber + " not found in subtask " + executionVertex.getTaskNameWithSubtaskIndex(), HttpResponseStatus.NOT_FOUND); } } else { throw new RestHandlerException("Invalid attempt num " + attemptNumber, HttpResponseStatus.NOT_FOUND); } }
Example 3
Source File: AbstractSubtaskAttemptHandler.java From flink with Apache License 2.0 | 6 votes |
@Override protected R handleRequest(HandlerRequest<EmptyRequestBody, M> request, AccessExecutionVertex executionVertex) throws RestHandlerException { final Integer attemptNumber = request.getPathParameter(SubtaskAttemptPathParameter.class); final AccessExecution currentAttempt = executionVertex.getCurrentExecutionAttempt(); if (attemptNumber == currentAttempt.getAttemptNumber()) { return handleRequest(request, currentAttempt); } else if (attemptNumber >= 0 && attemptNumber < currentAttempt.getAttemptNumber()) { final AccessExecution execution = executionVertex.getPriorExecutionAttempt(attemptNumber); if (execution != null) { return handleRequest(request, execution); } else { throw new RestHandlerException("Attempt " + attemptNumber + " not found in subtask " + executionVertex.getTaskNameWithSubtaskIndex(), HttpResponseStatus.NOT_FOUND); } } else { throw new RestHandlerException("Invalid attempt num " + attemptNumber, HttpResponseStatus.NOT_FOUND); } }
Example 4
Source File: SubtaskExecutionAttemptDetailsInfo.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, MutableIOMetrics ioMetrics) { final ExecutionState status = execution.getState(); final long now = System.currentTimeMillis(); final TaskManagerLocation location = execution.getAssignedResourceLocation(); final String locationString = location == null ? "(unassigned)" : location.getHostname(); long startTime = execution.getStateTimestamp(ExecutionState.DEPLOYING); if (startTime == 0) { startTime = -1; } final long endTime = status.isTerminal() ? execution.getStateTimestamp(status) : -1; final long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1; final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo( ioMetrics.getNumBytesInLocal() + ioMetrics.getNumBytesInRemote(), ioMetrics.isNumBytesInLocalComplete() && ioMetrics.isNumBytesInRemoteComplete(), ioMetrics.getNumBytesOut(), ioMetrics.isNumBytesOutComplete(), ioMetrics.getNumRecordsIn(), ioMetrics.isNumRecordsInComplete(), ioMetrics.getNumRecordsOut(), ioMetrics.isNumRecordsOutComplete()); return new SubtaskExecutionAttemptDetailsInfo( execution.getParallelSubtaskIndex(), status, execution.getAttemptNumber(), locationString, startTime, endTime, duration, ioMetricsInfo ); }
Example 5
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private static SubtaskExecutionAttemptAccumulatorsInfo createAccumulatorInfo(AccessExecution execution) { final StringifiedAccumulatorResult[] accs = execution.getUserAccumulatorsStringified(); final ArrayList<UserAccumulator> userAccumulatorList = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulatorList.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } return new SubtaskExecutionAttemptAccumulatorsInfo( execution.getParallelSubtaskIndex(), execution.getAttemptNumber(), execution.getAttemptId().toString(), userAccumulatorList); }
Example 6
Source File: SubtaskExecutionAttemptDetailsInfo.java From flink with Apache License 2.0 | 5 votes |
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, MutableIOMetrics ioMetrics) { final ExecutionState status = execution.getState(); final long now = System.currentTimeMillis(); final TaskManagerLocation location = execution.getAssignedResourceLocation(); final String locationString = location == null ? "(unassigned)" : location.getHostname(); long startTime = execution.getStateTimestamp(ExecutionState.DEPLOYING); if (startTime == 0) { startTime = -1; } final long endTime = status.isTerminal() ? execution.getStateTimestamp(status) : -1; final long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1; final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo( ioMetrics.getNumBytesIn(), ioMetrics.isNumBytesInComplete(), ioMetrics.getNumBytesOut(), ioMetrics.isNumBytesOutComplete(), ioMetrics.getNumRecordsIn(), ioMetrics.isNumRecordsInComplete(), ioMetrics.getNumRecordsOut(), ioMetrics.isNumRecordsOutComplete()); return new SubtaskExecutionAttemptDetailsInfo( execution.getParallelSubtaskIndex(), status, execution.getAttemptNumber(), locationString, startTime, endTime, duration, ioMetricsInfo ); }
Example 7
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
private static SubtaskExecutionAttemptAccumulatorsInfo createAccumulatorInfo(AccessExecution execution) { final StringifiedAccumulatorResult[] accs = execution.getUserAccumulatorsStringified(); final ArrayList<UserAccumulator> userAccumulatorList = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulatorList.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } return new SubtaskExecutionAttemptAccumulatorsInfo( execution.getParallelSubtaskIndex(), execution.getAttemptNumber(), execution.getAttemptId().toString(), userAccumulatorList); }
Example 8
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
private static SubtaskExecutionAttemptAccumulatorsInfo createAccumulatorInfo(AccessExecution execution) { final StringifiedAccumulatorResult[] accs = execution.getUserAccumulatorsStringified(); final ArrayList<UserAccumulator> userAccumulatorList = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulatorList.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } return new SubtaskExecutionAttemptAccumulatorsInfo( execution.getParallelSubtaskIndex(), execution.getAttemptNumber(), execution.getAttemptId().toString(), userAccumulatorList); }
Example 9
Source File: SubtaskExecutionAttemptDetailsInfo.java From flink with Apache License 2.0 | 4 votes |
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, @Nullable MetricFetcher metricFetcher, JobID jobID, JobVertexID jobVertexID) { final ExecutionState status = execution.getState(); final long now = System.currentTimeMillis(); final TaskManagerLocation location = execution.getAssignedResourceLocation(); final String locationString = location == null ? "(unassigned)" : location.getHostname(); String taskmanagerId = location == null ? "(unassigned)" : location.getResourceID().toString(); long startTime = execution.getStateTimestamp(ExecutionState.DEPLOYING); if (startTime == 0) { startTime = -1; } final long endTime = status.isTerminal() ? execution.getStateTimestamp(status) : -1; final long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1; final MutableIOMetrics ioMetrics = new MutableIOMetrics(); ioMetrics.addIOMetrics( execution, metricFetcher, jobID.toString(), jobVertexID.toString() ); final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo( ioMetrics.getNumBytesIn(), ioMetrics.isNumBytesInComplete(), ioMetrics.getNumBytesOut(), ioMetrics.isNumBytesOutComplete(), ioMetrics.getNumRecordsIn(), ioMetrics.isNumRecordsInComplete(), ioMetrics.getNumRecordsOut(), ioMetrics.isNumRecordsOutComplete()); return new SubtaskExecutionAttemptDetailsInfo( execution.getParallelSubtaskIndex(), status, execution.getAttemptNumber(), locationString, startTime, endTime, duration, ioMetricsInfo, taskmanagerId ); }