Java Code Examples for org.apache.flink.runtime.webmonitor.RestfulGateway#triggerSavepoint()

The following examples show how to use org.apache.flink.runtime.webmonitor.RestfulGateway#triggerSavepoint() . 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-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 2
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 3
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 4
Source File: AbstractAsynchronousOperationHandlersTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	return gateway.triggerSavepoint(new JobID(), null, false, timeout);
}
 
Example 5
Source File: AbstractAsynchronousOperationHandlersTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	return gateway.triggerSavepoint(new JobID(), null, false, timeout);
}
 
Example 6
Source File: AbstractAsynchronousOperationHandlersTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
protected CompletableFuture<String> triggerOperation(HandlerRequest<EmptyRequestBody, EmptyMessageParameters> request, RestfulGateway gateway) throws RestHandlerException {
	return gateway.triggerSavepoint(new JobID(), null, false, timeout);
}