org.apache.flink.runtime.rest.messages.SubtaskIndexPathParameter Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.SubtaskIndexPathParameter. 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 Project: Flink-CEPplus   Author: ljygz   File: AbstractSubtaskHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #2
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskMetricsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
		HandlerRequest<EmptyRequestBody, SubtaskMetricsMessageParameters> request,
		MetricStore metricStore) {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final JobVertexID vertexId = request.getPathParameter(JobVertexIdPathParameter.class);
	final int subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class);

	return metricStore.getSubtaskMetricStore(jobId.toString(), vertexId.toString(), subtaskIndex);
}
 
Example #3
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptDetailsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #4
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptAccumulatorsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #5
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskMetricsHandlerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
Map<String, String> getPathParameters() {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID);
	pathParameters.put(JobVertexIdPathParameter.KEY, TEST_VERTEX_ID);
	pathParameters.put(SubtaskIndexPathParameter.KEY, Integer.toString(TEST_SUBTASK_INDEX));
	return pathParameters;
}
 
Example #6
Source Project: flink   Author: flink-tpc-ds   File: AbstractSubtaskHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 Project: flink   Author: flink-tpc-ds   File: SubtaskMetricsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
		HandlerRequest<EmptyRequestBody, SubtaskMetricsMessageParameters> request,
		MetricStore metricStore) {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final JobVertexID vertexId = request.getPathParameter(JobVertexIdPathParameter.class);
	final int subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class);

	return metricStore.getSubtaskMetricStore(jobId.toString(), vertexId.toString(), subtaskIndex);
}
 
Example #8
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptDetailsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #9
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptAccumulatorsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 Project: flink   Author: flink-tpc-ds   File: SubtaskMetricsHandlerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
Map<String, String> getPathParameters() {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID);
	pathParameters.put(JobVertexIdPathParameter.KEY, TEST_VERTEX_ID);
	pathParameters.put(SubtaskIndexPathParameter.KEY, Integer.toString(TEST_SUBTASK_INDEX));
	return pathParameters;
}
 
Example #11
Source Project: flink   Author: apache   File: AbstractSubtaskHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #12
Source Project: flink   Author: apache   File: SubtaskMetricsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
		HandlerRequest<EmptyRequestBody, SubtaskMetricsMessageParameters> request,
		MetricStore metricStore) {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final JobVertexID vertexId = request.getPathParameter(JobVertexIdPathParameter.class);
	final int subtaskIndex = request.getPathParameter(SubtaskIndexPathParameter.class);

	return metricStore.getSubtaskMetricStore(jobId.toString(), vertexId.toString(), subtaskIndex);
}
 
Example #13
Source Project: flink   Author: apache   File: SubtaskExecutionAttemptDetailsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #14
Source Project: flink   Author: apache   File: SubtaskExecutionAttemptAccumulatorsHandler.java    License: Apache License 2.0 5 votes vote down vote up
@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 #15
Source Project: flink   Author: apache   File: SubtaskMetricsHandlerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
Map<String, String> getPathParameters() {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID);
	pathParameters.put(JobVertexIdPathParameter.KEY, TEST_VERTEX_ID);
	pathParameters.put(SubtaskIndexPathParameter.KEY, Integer.toString(TEST_SUBTASK_INDEX));
	return pathParameters;
}
 
Example #16
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskMetricsHeaders.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String getTargetRestEndpointURL() {
	return "/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
		"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics";
}
 
Example #17
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskMetricsHeadersTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testUrl() {
	assertThat(subtaskMetricsHeaders.getTargetRestEndpointURL(),
		equalTo("/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
			"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics"));
}
 
Example #18
Source Project: flink   Author: flink-tpc-ds   File: SubtaskMetricsHeaders.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String getTargetRestEndpointURL() {
	return "/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
		"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics";
}
 
Example #19
Source Project: flink   Author: flink-tpc-ds   File: SubtaskMetricsHeadersTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testUrl() {
	assertThat(subtaskMetricsHeaders.getTargetRestEndpointURL(),
		equalTo("/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
			"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics"));
}
 
Example #20
Source Project: flink   Author: apache   File: SubtaskMetricsHeaders.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String getTargetRestEndpointURL() {
	return "/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
		"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics";
}
 
Example #21
Source Project: flink   Author: apache   File: SubtaskMetricsHeadersTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testUrl() {
	assertThat(subtaskMetricsHeaders.getTargetRestEndpointURL(),
		equalTo("/jobs/:" + JobIDPathParameter.KEY + "/vertices/:" + JobVertexIdPathParameter.KEY +
			"/subtasks/:" + SubtaskIndexPathParameter.KEY + "/metrics"));
}