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

The following examples show how to use org.apache.flink.runtime.rest.messages.JobIDPathParameter. 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: SavepointHandlers.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory();

	if (requestedTargetDirectory == null && defaultSavepointDir == null) {
		throw new RestHandlerException(
				String.format("Config key [%s] is not set. Property [%s] must be provided.",
					CheckpointingOptions.SAVEPOINT_DIRECTORY.key(),
					SavepointTriggerRequestBody.FIELD_NAME_TARGET_DIRECTORY),
				HttpResponseStatus.BAD_REQUEST);
	}

	final boolean cancelJob = request.getRequestBody().isCancelJob();
	final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir;
	return gateway.triggerSavepoint(jobId, targetDirectory, cancelJob, RpcUtils.INF_TIMEOUT);
}
 
Example #2
Source File: AggregatingSubtasksMetricsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregatedSubtaskMetricsParameters> request) {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID taskID = request.getPathParameter(JobVertexIdPathParameter.class);

	Collection<String> subtaskRanges = request.getQueryParameter(SubtasksFilterQueryParameter.class);
	if (subtaskRanges.isEmpty()) {
		MetricStore.TaskMetricStore taskMetricStore = store.getTaskMetricStore(jobID.toString(), taskID.toString());
		if (taskMetricStore != null) {
			return taskMetricStore.getAllSubtaskMetricStores();
		} else {
			return Collections.emptyList();
		}
	} else {
		Iterable<Integer> subtasks = getIntegerRangeFromString(subtaskRanges);
		Collection<MetricStore.ComponentMetricStore> subtaskStores = new ArrayList<>(8);
		for (int subtask : subtasks) {
			MetricStore.ComponentMetricStore subtaskMetricStore = store.getSubtaskMetricStore(jobID.toString(), taskID.toString(), subtask);
			if (subtaskMetricStore != null) {
				subtaskStores.add(subtaskMetricStore);
			}
		}
		return subtaskStores;
	}
}
 
Example #3
Source File: SavepointHandlers.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(HandlerRequest<SavepointTriggerRequestBody, SavepointTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory();

	if (requestedTargetDirectory == null && defaultSavepointDir == null) {
		throw new RestHandlerException(
				String.format("Config key [%s] is not set. Property [%s] must be provided.",
					CheckpointingOptions.SAVEPOINT_DIRECTORY.key(),
					SavepointTriggerRequestBody.FIELD_NAME_TARGET_DIRECTORY),
				HttpResponseStatus.BAD_REQUEST);
	}

	final boolean cancelJob = request.getRequestBody().isCancelJob();
	final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir;
	return gateway.triggerSavepoint(jobId, targetDirectory, cancelJob, RpcUtils.INF_TIMEOUT);
}
 
Example #4
Source File: CheckpointStatisticDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
	if (stats == null) {
		return Collections.emptyList();
	}
	CheckpointStatsHistory history = stats.getHistory();
	List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
	for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
		ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #5
Source File: TaskCheckpointStatisticDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
	if (stats == null) {
		return Collections.emptyList();
	}
	CheckpointStatsHistory history = stats.getHistory();
	List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
	for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
		for (TaskStateStats subtaskStats : checkpoint.getAllTaskStateStats()) {
			ResponseBody json = createCheckpointDetails(checkpoint, subtaskStats);
			String path = getMessageHeaders().getTargetRestEndpointURL()
				.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
				.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()))
				.replace(':' + JobVertexIdPathParameter.KEY, subtaskStats.getJobVertexId().toString());
			archive.add(new ArchivedJson(path, json));
		}
	}
	return archive;
}
 
Example #6
Source File: AbstractExecutionGraphHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<R> handleRequest(@Nonnull HandlerRequest<EmptyRequestBody, M> request, @Nonnull RestfulGateway gateway) throws RestHandlerException {
	JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	CompletableFuture<AccessExecutionGraph> executionGraphFuture = executionGraphCache.getExecutionGraph(jobId, gateway);

	return executionGraphFuture.thenApplyAsync(
		executionGraph -> {
			try {
				return handleRequest(request, executionGraph);
			} catch (RestHandlerException rhe) {
				throw new CompletionException(rhe);
			}
		}, executor)
		.exceptionally(throwable -> {
			throwable = ExceptionUtils.stripCompletionException(throwable);
			if (throwable instanceof FlinkJobNotFoundException) {
				throw new CompletionException(
					new NotFoundException(String.format("Job %s not found", jobId), throwable));
			} else {
				throw new CompletionException(throwable);
			}
		});
}
 
Example #7
Source File: SavepointHandlers.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(
		final HandlerRequest<StopWithSavepointRequestBody, SavepointTriggerMessageParameters> request,
		final RestfulGateway gateway) throws RestHandlerException {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final String requestedTargetDirectory = request.getRequestBody().getTargetDirectory();

	if (requestedTargetDirectory == null && defaultSavepointDir == null) {
		throw new RestHandlerException(
				String.format("Config key [%s] is not set. Property [%s] must be provided.",
						CheckpointingOptions.SAVEPOINT_DIRECTORY.key(),
						StopWithSavepointRequestBody.FIELD_NAME_TARGET_DIRECTORY),
				HttpResponseStatus.BAD_REQUEST);
	}

	final boolean advanceToEndOfEventTime = request.getRequestBody().shouldDrain();
	final String targetDirectory = requestedTargetDirectory != null ? requestedTargetDirectory : defaultSavepointDir;
	return gateway.stopWithSavepoint(jobId, targetDirectory, advanceToEndOfEventTime, RpcUtils.INF_TIMEOUT);
}
 
Example #8
Source File: CheckpointStatisticDetailsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	CheckpointStatsSnapshot stats = graph.getCheckpointStatsSnapshot();
	if (stats == null) {
		return Collections.emptyList();
	}
	CheckpointStatsHistory history = stats.getHistory();
	List<ArchivedJson> archive = new ArrayList<>(history.getCheckpoints().size());
	for (AbstractCheckpointStats checkpoint : history.getCheckpoints()) {
		ResponseBody json = CheckpointStatistics.generateCheckpointStatistics(checkpoint, true);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + CheckpointIdPathParameter.KEY, String.valueOf(checkpoint.getCheckpointId()));
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #9
Source File: JobExecutionResultHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<JobExecutionResultResponseBody> handleRequest(
		@Nonnull final HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		@Nonnull final RestfulGateway gateway) throws RestHandlerException {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	final CompletableFuture<JobStatus> jobStatusFuture = gateway.requestJobStatus(jobId, timeout);

	return jobStatusFuture.thenCompose(
		jobStatus -> {
			if (jobStatus.isGloballyTerminalState()) {
				return gateway
					.requestJobResult(jobId, timeout)
					.thenApply(JobExecutionResultResponseBody::created);
			} else {
				return CompletableFuture.completedFuture(
					JobExecutionResultResponseBody.inProgress());
			}
		}).exceptionally(throwable -> {
			throw propagateException(throwable);
		});
}
 
Example #10
Source File: RescalingHandlers.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<Acknowledge> triggerOperation(HandlerRequest<EmptyRequestBody, RescalingTriggerMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final List<Integer> queryParameter = request.getQueryParameter(RescalingParallelismQueryParameter.class);

	if (queryParameter.isEmpty()) {
		throw new RestHandlerException("No new parallelism was specified.", HttpResponseStatus.BAD_REQUEST);
	}

	final int newParallelism = queryParameter.get(0);

	final CompletableFuture<Acknowledge> rescalingFuture = gateway.rescaleJob(
		jobId,
		newParallelism,
		RescalingBehaviour.STRICT,
		RpcUtils.INF_TIMEOUT);

	return rescalingFuture;
}
 
Example #11
Source File: AggregatingSubtasksMetricsHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
Collection<? extends MetricStore.ComponentMetricStore> getStores(MetricStore store, HandlerRequest<EmptyRequestBody, AggregatedSubtaskMetricsParameters> request) {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID taskID = request.getPathParameter(JobVertexIdPathParameter.class);

	Collection<String> subtaskRanges = request.getQueryParameter(SubtasksFilterQueryParameter.class);
	if (subtaskRanges.isEmpty()) {
		MetricStore.TaskMetricStore taskMetricStore = store.getTaskMetricStore(jobID.toString(), taskID.toString());
		if (taskMetricStore != null) {
			return taskMetricStore.getAllSubtaskMetricStores();
		} else {
			return Collections.emptyList();
		}
	} else {
		Iterable<Integer> subtasks = getIntegerRangeFromString(subtaskRanges);
		Collection<MetricStore.ComponentMetricStore> subtaskStores = new ArrayList<>(8);
		for (int subtask : subtasks) {
			MetricStore.ComponentMetricStore subtaskMetricStore = store.getSubtaskMetricStore(jobID.toString(), taskID.toString(), subtask);
			if (subtaskMetricStore != null) {
				subtaskStores.add(subtaskMetricStore);
			}
		}
		return subtaskStores;
	}
}
 
Example #12
Source File: ClientCoordinationHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<ClientCoordinationResponseBody> handleRequest(
		@Nonnull HandlerRequest<ClientCoordinationRequestBody, ClientCoordinationMessageParameters> request,
		@Nonnull RestfulGateway gateway) throws RestHandlerException {
	JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	OperatorID operatorId = request.getPathParameter(OperatorIDPathParameter.class);
	SerializedValue<CoordinationRequest> serializedRequest =
		request.getRequestBody().getSerializedCoordinationRequest();
	CompletableFuture<CoordinationResponse> responseFuture =
		gateway.deliverCoordinationRequestToCoordinator(jobId, operatorId, serializedRequest, timeout);
	return responseFuture.thenApply(
		coordinationResponse -> {
			try {
				return new ClientCoordinationResponseBody(new SerializedValue<>(coordinationResponse));
			} catch (IOException e) {
				throw new CompletionException(
					new RestHandlerException(
						"Failed to serialize coordination response",
						HttpResponseStatus.INTERNAL_SERVER_ERROR,
						e));
			}
		});
}
 
Example #13
Source File: JobVertexBackPressureHandlerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testAbsentBackPressure() throws Exception {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, TEST_JOB_ID_BACK_PRESSURE_STATS_ABSENT.toString());
	pathParameters.put(JobVertexIdPathParameter.KEY, new JobVertexID().toString());

	final HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request =
		new HandlerRequest<>(
			EmptyRequestBody.getInstance(),
			new JobVertexMessageParameters(), pathParameters, Collections.emptyMap());

	final CompletableFuture<JobVertexBackPressureInfo> jobVertexBackPressureInfoCompletableFuture =
		jobVertexBackPressureHandler.handleRequest(request, restfulGateway);
	final JobVertexBackPressureInfo jobVertexBackPressureInfo = jobVertexBackPressureInfoCompletableFuture.get();

	assertThat(jobVertexBackPressureInfo.getStatus(), equalTo(VertexBackPressureStatus.DEPRECATED));
}
 
Example #14
Source File: JobExecutionResultHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
protected CompletableFuture<JobExecutionResultResponseBody> handleRequest(
		@Nonnull final HandlerRequest<EmptyRequestBody, JobMessageParameters> request,
		@Nonnull final RestfulGateway gateway) throws RestHandlerException {

	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);

	final CompletableFuture<JobStatus> jobStatusFuture = gateway.requestJobStatus(jobId, timeout);

	return jobStatusFuture.thenCompose(
		jobStatus -> {
			if (jobStatus.isGloballyTerminalState()) {
				return gateway
					.requestJobResult(jobId, timeout)
					.thenApply(JobExecutionResultResponseBody::created);
			} else {
				return CompletableFuture.completedFuture(
					JobExecutionResultResponseBody.inProgress());
			}
		}).exceptionally(throwable -> {
			throw propagateException(throwable);
		});
}
 
Example #15
Source File: JobVertexTaskManagersHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo handleRequest(
		HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		AccessExecutionGraph executionGraph) throws RestHandlerException {
	JobID jobID = request.getPathParameter(JobIDPathParameter.class);
	JobVertexID jobVertexID = request.getPathParameter(JobVertexIdPathParameter.class);
	AccessExecutionJobVertex jobVertex = executionGraph.getJobVertex(jobVertexID);

	if (jobVertex == null) {
		throw new NotFoundException(String.format("JobVertex %s not found", jobVertexID));
	}

	return createJobVertexTaskManagersInfo(jobVertex, jobID, metricFetcher);
}
 
Example #16
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = createJobDetailsInfo(graph, null);
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singleton(new ArchivedJson(path, json));
}
 
Example #17
Source File: JobVertexDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	Collection<? extends AccessExecutionJobVertex> vertices = graph.getAllVertices().values();
	List<ArchivedJson> archive = new ArrayList<>(vertices.size());
	for (AccessExecutionJobVertex task : vertices) {
		ResponseBody json = createJobVertexDetailsInfo(task, graph.getJobID(), null);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #18
Source File: JobConfigHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = createJobConfigInfo(graph);
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singleton(new ArchivedJson(path, json));
}
 
Example #19
Source File: JobsOverviewHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singletonList(new ArchivedJson(path, json));
}
 
Example #20
Source File: JobVertexBackPressureHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected CompletableFuture<JobVertexBackPressureInfo> handleRequest(
		@Nonnull HandlerRequest<EmptyRequestBody, JobVertexMessageParameters> request,
		@Nonnull RestfulGateway gateway) throws RestHandlerException {
	final JobID jobId = request.getPathParameter(JobIDPathParameter.class);
	final JobVertexID jobVertexId = request.getPathParameter(JobVertexIdPathParameter.class);
	return gateway
		.requestOperatorBackPressureStats(jobId, jobVertexId)
		.thenApply(
			operatorBackPressureStats ->
				operatorBackPressureStats.getOperatorBackPressureStats().map(
					JobVertexBackPressureHandler::createJobVertexBackPressureInfo).orElse(
					JobVertexBackPressureInfo.deprecated()));
}
 
Example #21
Source File: SubtaskExecutionAttemptAccumulatorsHandler.java    From flink with 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 #22
Source File: AggregatingSubtasksMetricsHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected Map<String, String> getPathParameters() {
	Map<String, String> pathParameters = new HashMap<>(4);
	pathParameters.put(JobIDPathParameter.KEY, JOB_ID.toString());
	pathParameters.put(JobVertexIdPathParameter.KEY, TASK_ID.toString());
	return pathParameters;
}
 
Example #23
Source File: SubtaskMetricsHandlerTest.java    From flink with 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 #24
Source File: JobAccumulatorsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = createJobAccumulatorsInfo(graph, true);
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singleton(new ArchivedJson(path, json));
}
 
Example #25
Source File: JobsOverviewHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = new MultipleJobsDetails(Collections.singleton(WebMonitorUtils.createDetailsForJob(graph)));
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singletonList(new ArchivedJson(path, json));
}
 
Example #26
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	ResponseBody json = createJobDetailsInfo(graph, null);
	String path = getMessageHeaders().getTargetRestEndpointURL()
		.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString());
	return Collections.singleton(new ArchivedJson(path, json));
}
 
Example #27
Source File: JobVertexMetricsHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected MetricStore.ComponentMetricStore getComponentMetricStore(
		HandlerRequest<EmptyRequestBody, JobVertexMetricsMessageParameters> request,
		MetricStore metricStore) {

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

	return metricStore.getTaskMetricStore(jobId.toString(), vertexId.toString());
}
 
Example #28
Source File: SubtasksTimesHandler.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<ArchivedJson> archiveJsonWithPath(AccessExecutionGraph graph) throws IOException {
	Collection<? extends AccessExecutionJobVertex> allVertices = graph.getAllVertices().values();
	List<ArchivedJson> archive = new ArrayList<>(allVertices.size());
	for (AccessExecutionJobVertex task : allVertices) {
		ResponseBody json = createSubtaskTimesInfo(task);
		String path = getMessageHeaders().getTargetRestEndpointURL()
			.replace(':' + JobIDPathParameter.KEY, graph.getJobID().toString())
			.replace(':' + JobVertexIdPathParameter.KEY, task.getJobVertexId().toString());
		archive.add(new ArchivedJson(path, json));
	}
	return archive;
}
 
Example #29
Source File: SubtaskExecutionAttemptDetailsHandler.java    From flink with 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 #30
Source File: JobExceptionsHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private static HandlerRequest<EmptyRequestBody, JobExceptionsMessageParameters> createRequest(JobID jobId, int size) throws HandlerRequestException {
	final Map<String, String> pathParameters = new HashMap<>();
	pathParameters.put(JobIDPathParameter.KEY, jobId.toString());
	final Map<String, List<String>> queryParameters = new HashMap<>();
	queryParameters.put(UpperLimitExceptionParameter.KEY, Collections.singletonList("" + size));

	return new HandlerRequest<>(
		EmptyRequestBody.getInstance(),
		new JobExceptionsMessageParameters(),
		pathParameters,
		queryParameters);
}