当前位置: 首页>>代码示例>>Java>>正文


Java JobGraph.addJar方法代码示例

本文整理汇总了Java中org.apache.flink.runtime.jobgraph.JobGraph.addJar方法的典型用法代码示例。如果您正苦于以下问题:Java JobGraph.addJar方法的具体用法?Java JobGraph.addJar怎么用?Java JobGraph.addJar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.runtime.jobgraph.JobGraph的用法示例。


在下文中一共展示了JobGraph.addJar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getJobGraph

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
private JobGraph getJobGraph(FlinkPlan optPlan, List<URL> jarFiles, List<URL> classpaths, SavepointRestoreSettings savepointSettings) {
	JobGraph job;
	if (optPlan instanceof StreamingPlan) {
		job = ((StreamingPlan) optPlan).getJobGraph();
		job.setSavepointRestoreSettings(savepointSettings);
	} else {
		JobGraphGenerator gen = new JobGraphGenerator(this.flinkConfig);
		job = gen.compileJobGraph((OptimizedPlan) optPlan);
	}

	for (URL jar : jarFiles) {
		try {
			job.addJar(new Path(jar.toURI()));
		} catch (URISyntaxException e) {
			throw new RuntimeException("URL is invalid. This should not happen.", e);
		}
	}

	job.setClasspaths(classpaths);

	return job;
}
 
开发者ID:datafibers-community,项目名称:df_data_service,代码行数:23,代码来源:DFCusterClient.java

示例2: execute

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Override
public JobExecutionResult execute(String jobName) throws Exception {
	OptimizedPlan op = compileProgram(jobName);

	JobGraphGenerator jgg = new JobGraphGenerator();
	JobGraph jobGraph = jgg.compileJobGraph(op);

	for (Path jarFile: jarFiles) {
		jobGraph.addJar(jarFile);
	}

	jobGraph.setClasspaths(new ArrayList<>(classPaths));

	this.lastJobExecutionResult = jobExecutor.executeJobBlocking(jobGraph);
	return this.lastJobExecutionResult;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:TestEnvironment.java

示例3: execute

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Override
public JobExecutionResult execute(String jobName) throws Exception {
	final StreamGraph streamGraph = getStreamGraph();
	streamGraph.setJobName(jobName);
	final JobGraph jobGraph = streamGraph.getJobGraph();

	for (Path jarFile: jarFiles) {
		jobGraph.addJar(jarFile);
	}

	jobGraph.setClasspaths(new ArrayList<>(classPaths));

	return jobExecutor.executeJobBlocking(jobGraph);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:TestStreamEnvironment.java

示例4: getJobGraphAndClassLoader

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
protected Tuple2<JobGraph, ClassLoader> getJobGraphAndClassLoader(JarActionHandlerConfig config) throws Exception {
	// generate the graph
	JobGraph graph = null;

	PackagedProgram program = new PackagedProgram(
			new File(jarDir, config.getJarFile()),
			config.getEntryClass(),
			config.getProgramArgs());
	ClassLoader classLoader = program.getUserCodeClassLoader();

	Optimizer optimizer = new Optimizer(new DataStatistics(), new DefaultCostEstimator(), new Configuration());
	FlinkPlan plan = ClusterClient.getOptimizedPlan(optimizer, program, config.getParallelism());

	if (plan instanceof StreamingPlan) {
		graph = ((StreamingPlan) plan).getJobGraph();
	} else if (plan instanceof OptimizedPlan) {
		graph = new JobGraphGenerator().compileJobGraph((OptimizedPlan) plan);
	}
	if (graph == null) {
		throw new CompilerException("A valid job graph couldn't be generated for the jar.");
	}

	// Set the savepoint settings
	graph.setSavepointRestoreSettings(config.getSavepointRestoreSettings());

	for (URL jar : program.getAllLibraries()) {
		try {
			graph.addJar(new Path(jar.toURI()));
		}
		catch (URISyntaxException e) {
			throw new ProgramInvocationException("Invalid jar path. Unexpected error. :(");
		}
	}
	return Tuple2.of(graph, classLoader);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:36,代码来源:JarActionHandler.java

示例5: testPerJobMode

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Ignore("The cluster cannot be stopped yet.")
@Test
public void testPerJobMode() throws Exception {
	Configuration configuration = new Configuration();
	configuration.setString(AkkaOptions.ASK_TIMEOUT, "30 s");
	final YarnClient yarnClient = YarnClient.createYarnClient();

	try (final Flip6YarnClusterDescriptor flip6YarnClusterDescriptor = new Flip6YarnClusterDescriptor(
		configuration,
		System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR),
		yarnClient)) {

		flip6YarnClusterDescriptor.setLocalJarPath(new Path(flinkUberjar.getAbsolutePath()));
		flip6YarnClusterDescriptor.addShipFiles(Arrays.asList(flinkLibFolder.listFiles()));

		final ClusterSpecification clusterSpecification = new ClusterSpecification.ClusterSpecificationBuilder()
			.setMasterMemoryMB(768)
			.setTaskManagerMemoryMB(1024)
			.setSlotsPerTaskManager(1)
			.setNumberTaskManagers(1)
			.createClusterSpecification();

		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		env.setParallelism(2);

		env.addSource(new InfiniteSource())
			.shuffle()
			.addSink(new DiscardingSink<Integer>());

		final JobGraph jobGraph = env.getStreamGraph().getJobGraph();

		File testingJar = YarnTestBase.findFile("..", new TestingYarnClusterDescriptor.TestJarFinder("flink-yarn-tests"));

		jobGraph.addJar(new org.apache.flink.core.fs.Path(testingJar.toURI()));

		ClusterClient<ApplicationId> clusterClient = flip6YarnClusterDescriptor.deployJobCluster(clusterSpecification, jobGraph);

		clusterClient.shutdown();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:41,代码来源:YARNITCase.java


注:本文中的org.apache.flink.runtime.jobgraph.JobGraph.addJar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。