Java Code Examples for org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex#getTaskVertices()
The following examples show how to use
org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex#getTaskVertices() .
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: JobVertexDetailsHandler.java From flink with Apache License 2.0 | 6 votes |
private static JobVertexDetailsInfo createJobVertexDetailsInfo(AccessExecutionJobVertex jobVertex, JobID jobID, @Nullable MetricFetcher metricFetcher) { List<SubtaskExecutionAttemptDetailsInfo> subtasks = new ArrayList<>(); final long now = System.currentTimeMillis(); for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { final AccessExecution execution = vertex.getCurrentExecutionAttempt(); final JobVertexID jobVertexID = jobVertex.getJobVertexId(); subtasks.add(SubtaskExecutionAttemptDetailsInfo.create(execution, metricFetcher, jobID, jobVertexID)); } return new JobVertexDetailsInfo( jobVertex.getJobVertexId(), jobVertex.getName(), jobVertex.getParallelism(), now, subtasks); }
Example 2
Source File: SubtaskExecutionAttemptDetailsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = createDetailsInfo(subtask.getCurrentExecutionAttempt(), graph.getJobID(), task.getJobVertexId(), null); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null) { ResponseBody json = createDetailsInfo(attempt, graph.getJobID(), task.getJobVertexId(), null); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 3
Source File: SubtasksAllAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected SubtasksAllAccumulatorsInfo handleRequest(HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { JobVertexID jobVertexId = jobVertex.getJobVertexId(); int parallelism = jobVertex.getParallelism(); final List<SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo> subtaskAccumulatorsInfos = new ArrayList<>(); for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); StringifiedAccumulatorResult[] accs = vertex.getCurrentExecutionAttempt().getUserAccumulatorsStringified(); List<UserAccumulator> userAccumulators = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulators.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } subtaskAccumulatorsInfos.add( new SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo( vertex.getCurrentExecutionAttempt().getParallelSubtaskIndex(), vertex.getCurrentExecutionAttempt().getAttemptNumber(), locationString, userAccumulators )); } return new SubtasksAllAccumulatorsInfo(jobVertexId, parallelism, subtaskAccumulatorsInfos); }
Example 4
Source File: SubtaskExecutionAttemptDetailsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = SubtaskExecutionAttemptDetailsInfo.create(subtask.getCurrentExecutionAttempt(), null, graph.getJobID(), task.getJobVertexId()); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null) { ResponseBody json = SubtaskExecutionAttemptDetailsInfo.create(attempt, null, graph.getJobID(), task.getJobVertexId()); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 5
Source File: JobVertexWatermarksHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected MetricCollectionResponseBody handleRequest( HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { String jobID = request.getPathParameter(JobIDPathParameter.class).toString(); String taskID = jobVertex.getJobVertexId().toString(); metricFetcher.update(); MetricStore.TaskMetricStore taskMetricStore = metricFetcher.getMetricStore().getTaskMetricStore(jobID, taskID); if (taskMetricStore == null) { return new MetricCollectionResponseBody(Collections.emptyList()); } AccessExecutionVertex[] taskVertices = jobVertex.getTaskVertices(); List<Metric> metrics = new ArrayList<>(taskVertices.length); for (AccessExecutionVertex taskVertex : taskVertices) { String id = taskVertex.getParallelSubtaskIndex() + "." + MetricNames.IO_CURRENT_INPUT_WATERMARK; String watermarkValue = taskMetricStore.getMetric(id); if (watermarkValue != null) { metrics.add(new Metric(id, watermarkValue)); } } return new MetricCollectionResponseBody(metrics); }
Example 6
Source File: AbstractSubtaskHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected R handleRequest( HandlerRequest<EmptyRequestBody, M> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { final Integer subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class); final AccessExecutionVertex[] executionVertices = jobVertex.getTaskVertices(); if (subtaskIndex >= executionVertices.length || subtaskIndex < 0) { throw new RestHandlerException("Invalid subtask index for vertex " + jobVertex.getJobVertexId(), HttpResponseStatus.NOT_FOUND); } return handleRequest(request, executionVertices[subtaskIndex]); }
Example 7
Source File: SubtasksTimesHandler.java From flink with Apache License 2.0 | 5 votes |
private static SubtasksTimesInfo createSubtaskTimesInfo(AccessExecutionJobVertex jobVertex) { final String id = jobVertex.getJobVertexId().toString(); final String name = jobVertex.getName(); final long now = System.currentTimeMillis(); final List<SubtasksTimesInfo.SubtaskTimeInfo> subtasks = new ArrayList<>(); int num = 0; for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { long[] timestamps = vertex.getCurrentExecutionAttempt().getStateTimestamps(); ExecutionState status = vertex.getExecutionState(); long scheduledTime = timestamps[ExecutionState.SCHEDULED.ordinal()]; long start = scheduledTime > 0 ? scheduledTime : -1; long end = status.isTerminal() ? timestamps[status.ordinal()] : now; long duration = start >= 0 ? end - start : -1L; TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); Map<ExecutionState, Long> timestampMap = new HashMap<>(ExecutionState.values().length); for (ExecutionState state : ExecutionState.values()) { timestampMap.put(state, timestamps[state.ordinal()]); } subtasks.add(new SubtasksTimesInfo.SubtaskTimeInfo( num++, locationString, duration, timestampMap)); } return new SubtasksTimesInfo(id, name, now, subtasks); }
Example 8
Source File: WebMonitorUtils.java From flink with Apache License 2.0 | 5 votes |
public static JobDetails createDetailsForJob(AccessExecutionGraph job) { JobStatus status = job.getState(); long started = job.getStatusTimestamp(JobStatus.CREATED); long finished = status.isGloballyTerminalState() ? job.getStatusTimestamp(status) : -1L; long duration = (finished >= 0L ? finished : System.currentTimeMillis()) - started; int[] countsPerStatus = new int[ExecutionState.values().length]; long lastChanged = 0; int numTotalTasks = 0; for (AccessExecutionJobVertex ejv : job.getVerticesTopologically()) { AccessExecutionVertex[] vertices = ejv.getTaskVertices(); numTotalTasks += vertices.length; for (AccessExecutionVertex vertex : vertices) { ExecutionState state = vertex.getExecutionState(); countsPerStatus[state.ordinal()]++; lastChanged = Math.max(lastChanged, vertex.getStateTimestamp(state)); } } lastChanged = Math.max(lastChanged, finished); return new JobDetails( job.getJobID(), job.getJobName(), started, finished, duration, status, lastChanged, countsPerStatus, numTotalTasks); }
Example 9
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = createAccumulatorInfo(subtask.getCurrentExecutionAttempt()); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null){ ResponseBody json = createAccumulatorInfo(attempt); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 10
Source File: SubtasksAllAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected SubtasksAllAccumulatorsInfo handleRequest(HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { JobVertexID jobVertexId = jobVertex.getJobVertexId(); int parallelism = jobVertex.getParallelism(); final List<SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo> subtaskAccumulatorsInfos = new ArrayList<>(); for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); StringifiedAccumulatorResult[] accs = vertex.getCurrentExecutionAttempt().getUserAccumulatorsStringified(); List<UserAccumulator> userAccumulators = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulators.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } subtaskAccumulatorsInfos.add( new SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo( vertex.getCurrentExecutionAttempt().getParallelSubtaskIndex(), vertex.getCurrentExecutionAttempt().getAttemptNumber(), locationString, userAccumulators )); } return new SubtasksAllAccumulatorsInfo(jobVertexId, parallelism, subtaskAccumulatorsInfos); }
Example 11
Source File: WebMonitorUtils.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public static JobDetails createDetailsForJob(AccessExecutionGraph job) { JobStatus status = job.getState(); long started = job.getStatusTimestamp(JobStatus.CREATED); long finished = status.isGloballyTerminalState() ? job.getStatusTimestamp(status) : -1L; long duration = (finished >= 0L ? finished : System.currentTimeMillis()) - started; int[] countsPerStatus = new int[ExecutionState.values().length]; long lastChanged = 0; int numTotalTasks = 0; for (AccessExecutionJobVertex ejv : job.getVerticesTopologically()) { AccessExecutionVertex[] vertices = ejv.getTaskVertices(); numTotalTasks += vertices.length; for (AccessExecutionVertex vertex : vertices) { ExecutionState state = vertex.getExecutionState(); countsPerStatus[state.ordinal()]++; lastChanged = Math.max(lastChanged, vertex.getStateTimestamp(state)); } } lastChanged = Math.max(lastChanged, finished); return new JobDetails( job.getJobID(), job.getJobName(), started, finished, duration, status, lastChanged, countsPerStatus, numTotalTasks); }
Example 12
Source File: AbstractSubtaskHandler.java From flink with Apache License 2.0 | 5 votes |
@Override protected R handleRequest( HandlerRequest<EmptyRequestBody, M> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { final Integer subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class); final AccessExecutionVertex[] executionVertices = jobVertex.getTaskVertices(); if (subtaskIndex >= executionVertices.length || subtaskIndex < 0) { throw new RestHandlerException("Invalid subtask index for vertex " + jobVertex.getJobVertexId(), HttpResponseStatus.NOT_FOUND); } return handleRequest(request, executionVertices[subtaskIndex]); }
Example 13
Source File: SubtasksTimesHandler.java From flink with Apache License 2.0 | 5 votes |
private static SubtasksTimesInfo createSubtaskTimesInfo(AccessExecutionJobVertex jobVertex) { final String id = jobVertex.getJobVertexId().toString(); final String name = jobVertex.getName(); final long now = System.currentTimeMillis(); final List<SubtasksTimesInfo.SubtaskTimeInfo> subtasks = new ArrayList<>(); int num = 0; for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { long[] timestamps = vertex.getCurrentExecutionAttempt().getStateTimestamps(); ExecutionState status = vertex.getExecutionState(); long scheduledTime = timestamps[ExecutionState.SCHEDULED.ordinal()]; long start = scheduledTime > 0 ? scheduledTime : -1; long end = status.isTerminal() ? timestamps[status.ordinal()] : now; long duration = start >= 0 ? end - start : -1L; TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); Map<ExecutionState, Long> timestampMap = new HashMap<>(ExecutionState.values().length); for (ExecutionState state : ExecutionState.values()) { timestampMap.put(state, timestamps[state.ordinal()]); } subtasks.add(new SubtasksTimesInfo.SubtaskTimeInfo( num++, locationString, duration, timestampMap)); } return new SubtasksTimesInfo(id, name, now, subtasks); }
Example 14
Source File: WebMonitorUtils.java From flink with Apache License 2.0 | 5 votes |
public static JobDetails createDetailsForJob(AccessExecutionGraph job) { JobStatus status = job.getState(); long started = job.getStatusTimestamp(JobStatus.CREATED); long finished = status.isGloballyTerminalState() ? job.getStatusTimestamp(status) : -1L; long duration = (finished >= 0L ? finished : System.currentTimeMillis()) - started; int[] countsPerStatus = new int[ExecutionState.values().length]; long lastChanged = 0; int numTotalTasks = 0; for (AccessExecutionJobVertex ejv : job.getVerticesTopologically()) { AccessExecutionVertex[] vertices = ejv.getTaskVertices(); numTotalTasks += vertices.length; for (AccessExecutionVertex vertex : vertices) { ExecutionState state = vertex.getExecutionState(); countsPerStatus[state.ordinal()]++; lastChanged = Math.max(lastChanged, vertex.getStateTimestamp(state)); } } lastChanged = Math.max(lastChanged, finished); return new JobDetails( job.getJobID(), job.getJobName(), started, finished, duration, status, lastChanged, countsPerStatus, numTotalTasks); }
Example 15
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From flink with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = createAccumulatorInfo(subtask.getCurrentExecutionAttempt()); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null){ ResponseBody json = createAccumulatorInfo(attempt); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 16
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = createAccumulatorInfo(subtask.getCurrentExecutionAttempt()); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null){ ResponseBody json = createAccumulatorInfo(attempt); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 17
Source File: SubtasksAllAccumulatorsHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected SubtasksAllAccumulatorsInfo handleRequest(HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { JobVertexID jobVertexId = jobVertex.getJobVertexId(); int parallelism = jobVertex.getParallelism(); final List<SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo> subtaskAccumulatorsInfos = new ArrayList<>(); for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); StringifiedAccumulatorResult[] accs = vertex.getCurrentExecutionAttempt().getUserAccumulatorsStringified(); List<UserAccumulator> userAccumulators = new ArrayList<>(accs.length); for (StringifiedAccumulatorResult acc : accs) { userAccumulators.add(new UserAccumulator(acc.getName(), acc.getType(), acc.getValue())); } subtaskAccumulatorsInfos.add( new SubtasksAllAccumulatorsInfo.SubtaskAccumulatorsInfo( vertex.getCurrentExecutionAttempt().getParallelSubtaskIndex(), vertex.getCurrentExecutionAttempt().getAttemptNumber(), locationString, userAccumulators )); } return new SubtasksAllAccumulatorsInfo(jobVertexId, parallelism, subtaskAccumulatorsInfos); }
Example 18
Source File: SubtaskExecutionAttemptDetailsHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException { List<ArchivedJson> archive = new ArrayList<>(16); for (AccessExecutionJobVertex task : graph.getAllVertices().values()) { for (AccessExecutionVertex subtask : task.getTaskVertices()) { ResponseBody curAttemptJson = createDetailsInfo(subtask.getCurrentExecutionAttempt(), graph.getJobID(), task.getJobVertexId(), null); String curAttemptPath = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(subtask.getCurrentExecutionAttempt().getAttemptNumber())); archive.add(new ArchivedJson(curAttemptPath, curAttemptJson)); for (int x = 0; x < subtask.getCurrentExecutionAttempt().getAttemptNumber(); x++) { AccessExecution attempt = subtask.getPriorExecutionAttempt(x); if (attempt != null) { ResponseBody json = createDetailsInfo(attempt, graph.getJobID(), task.getJobVertexId(), null); String path = getMessageHeaders().getTargetRestEndpointURL() .replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString()) .replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString()) .replace(':' + SubtaskIndexPathParameter.KEY, String.valueOf(subtask.getParallelSubtaskIndex())) .replace(':' + SubtaskAttemptPathParameter.KEY, String.valueOf(attempt.getAttemptNumber())); archive.add(new ArchivedJson(path, json)); } } } } return archive; }
Example 19
Source File: AbstractSubtaskHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override protected R handleRequest( HandlerRequest<EmptyRequestBody, M> request, AccessExecutionJobVertex jobVertex) throws RestHandlerException { final Integer subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class); final AccessExecutionVertex[] executionVertices = jobVertex.getTaskVertices(); if (subtaskIndex >= executionVertices.length || subtaskIndex < 0) { throw new RestHandlerException("Invalid subtask index for vertex " + jobVertex.getJobVertexId(), HttpResponseStatus.NOT_FOUND); } return handleRequest(request, executionVertices[subtaskIndex]); }
Example 20
Source File: SubtasksTimesHandler.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
private static SubtasksTimesInfo createSubtaskTimesInfo(AccessExecutionJobVertex jobVertex) { final String id = jobVertex.getJobVertexId().toString(); final String name = jobVertex.getName(); final long now = System.currentTimeMillis(); final List<SubtasksTimesInfo.SubtaskTimeInfo> subtasks = new ArrayList<>(); int num = 0; for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) { long[] timestamps = vertex.getCurrentExecutionAttempt().getStateTimestamps(); ExecutionState status = vertex.getExecutionState(); long scheduledTime = timestamps[ExecutionState.SCHEDULED.ordinal()]; long start = scheduledTime > 0 ? scheduledTime : -1; long end = status.isTerminal() ? timestamps[status.ordinal()] : now; long duration = start >= 0 ? end - start : -1L; TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation(); String locationString = location == null ? "(unassigned)" : location.getHostname(); Map<ExecutionState, Long> timestampMap = new HashMap<>(ExecutionState.values().length); for (ExecutionState state : ExecutionState.values()) { timestampMap.put(state, timestamps[state.ordinal()]); } subtasks.add(new SubtasksTimesInfo.SubtaskTimeInfo( num++, locationString, duration, timestampMap)); } return new SubtasksTimesInfo(id, name, now, subtasks); }