org.apache.flink.runtime.webmonitor.handlers.JarIdPathParameter Java Examples

The following examples show how to use org.apache.flink.runtime.webmonitor.handlers.JarIdPathParameter. 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: JarHandlerUtils.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static <R extends JarRequestBody> JarHandlerContext fromRequest(
		@Nonnull final HandlerRequest<R, ?> request,
		@Nonnull final Path jarDir,
		@Nonnull final Logger log) throws RestHandlerException {
	final JarRequestBody requestBody = request.getRequestBody();

	final String pathParameter = request.getPathParameter(JarIdPathParameter.class);
	Path jarFile = jarDir.resolve(pathParameter);

	String entryClass = fromRequestBodyOrQueryParameter(
		emptyToNull(requestBody.getEntryClassName()),
		() -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)),
		null,
		log);

	List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log);

	int parallelism = fromRequestBodyOrQueryParameter(
		requestBody.getParallelism(),
		() -> getQueryParameter(request, ParallelismQueryParameter.class),
		ExecutionConfig.PARALLELISM_DEFAULT,
		log);

	JobID jobId = fromRequestBodyOrQueryParameter(
		requestBody.getJobId(),
		() -> null, // No support via query parameter
		null, // Delegate default job ID to actual JobGraph generation
		log);

	return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId);
}
 
Example #2
Source File: JarHandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static <R extends JarRequestBody> JarHandlerContext fromRequest(
		@Nonnull final HandlerRequest<R, ?> request,
		@Nonnull final Path jarDir,
		@Nonnull final Logger log) throws RestHandlerException {
	final JarRequestBody requestBody = request.getRequestBody();

	final String pathParameter = request.getPathParameter(JarIdPathParameter.class);
	Path jarFile = jarDir.resolve(pathParameter);

	String entryClass = fromRequestBodyOrQueryParameter(
		emptyToNull(requestBody.getEntryClassName()),
		() -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)),
		null,
		log);

	List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log);

	int parallelism = fromRequestBodyOrQueryParameter(
		requestBody.getParallelism(),
		() -> getQueryParameter(request, ParallelismQueryParameter.class),
		ExecutionConfig.PARALLELISM_DEFAULT,
		log);

	JobID jobId = fromRequestBodyOrQueryParameter(
		requestBody.getJobId(),
		() -> null, // No support via query parameter
		null, // Delegate default job ID to actual JobGraph generation
		log);

	return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId);
}
 
Example #3
Source File: JarHandlerUtils.java    From flink with Apache License 2.0 5 votes vote down vote up
public static <R extends JarRequestBody> JarHandlerContext fromRequest(
		@Nonnull final HandlerRequest<R, ?> request,
		@Nonnull final Path jarDir,
		@Nonnull final Logger log) throws RestHandlerException {
	final JarRequestBody requestBody = request.getRequestBody();

	final String pathParameter = request.getPathParameter(JarIdPathParameter.class);
	Path jarFile = jarDir.resolve(pathParameter);

	String entryClass = fromRequestBodyOrQueryParameter(
		emptyToNull(requestBody.getEntryClassName()),
		() -> emptyToNull(getQueryParameter(request, EntryClassQueryParameter.class)),
		null,
		log);

	List<String> programArgs = JarHandlerUtils.getProgramArgs(request, log);

	int parallelism = fromRequestBodyOrQueryParameter(
		requestBody.getParallelism(),
		() -> getQueryParameter(request, ParallelismQueryParameter.class),
		CoreOptions.DEFAULT_PARALLELISM.defaultValue(),
		log);

	JobID jobId = fromRequestBodyOrQueryParameter(
		requestBody.getJobId(),
		() -> null, // No support via query parameter
		null, // Delegate default job ID to actual JobGraph generation
		log);

	return new JarHandlerContext(jarFile, entryClass, programArgs, parallelism, jobId);
}