• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java JobGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



JobGraph类属于org.apache.flink.runtime.jobgraph包,在下文中一共展示了JobGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testDeployerWithIsolatedConfiguration

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@Test
public void testDeployerWithIsolatedConfiguration() throws Exception {
  YarnClusterConfiguration clusterConf = mock(YarnClusterConfiguration.class);
  doReturn(new YarnConfiguration()).when(clusterConf).conf();
  ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
  Configuration flinkConf = new Configuration();
  YarnClient client = mock(YarnClient.class);
  JobDeployer deploy = new JobDeployer(clusterConf, client, executor, flinkConf);
  AthenaXYarnClusterDescriptor desc = mock(AthenaXYarnClusterDescriptor.class);

  YarnClusterClient clusterClient = mock(YarnClusterClient.class);
  doReturn(clusterClient).when(desc).deploy();

  ActorGateway actorGateway = mock(ActorGateway.class);
  doReturn(actorGateway).when(clusterClient).getJobManagerGateway();
  doReturn(Future$.MODULE$.successful(null)).when(actorGateway).ask(any(), any());

  JobGraph jobGraph = mock(JobGraph.class);
  doReturn(JobID.generate()).when(jobGraph).getJobID();
  deploy.start(desc, jobGraph);

  ArgumentCaptor<Configuration> args = ArgumentCaptor.forClass(Configuration.class);
  verify(desc).setFlinkConfiguration(args.capture());
  assertNotSame(flinkConf, args.getValue());
}
 
开发者ID:uber,项目名称:AthenaX,代码行数:26,代码来源:JobDeployerTest.java


示例2: 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


示例3: setup

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@BeforeClass
public static void setup() {
	try {
		Configuration config = new Configuration();
		config.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 4L);
		config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
		config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, NUM_SLOTS / 2);

		cluster = new LocalFlinkMiniCluster(config);

		cluster.start();

		final JobVertex jobVertex = new JobVertex("Working job vertex.");
		jobVertex.setInvokableClass(NoOpInvokable.class);
		workingJobGraph = new JobGraph("Working testing job", jobVertex);
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JobSubmissionFailsITCase.java


示例4: testAutomaticRestartingWhenCheckpointing

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * Tests that in a streaming use case where checkpointing is enabled, a
 * fixed delay with Integer.MAX_VALUE retries is instantiated if no other restart
 * strategy has been specified.
 */
@Test
public void testAutomaticRestartingWhenCheckpointing() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
	env.enableCheckpointing(500);

	env.fromElements(1).print();

	StreamGraph graph = env.getStreamGraph();
	JobGraph jobGraph = graph.getJobGraph();

	RestartStrategies.RestartStrategyConfiguration restartStrategy =
		jobGraph.getSerializedExecutionConfig().deserializeValue(getClass().getClassLoader()).getRestartStrategy();

	Assert.assertNotNull(restartStrategy);
	Assert.assertTrue(restartStrategy instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration);
	Assert.assertEquals(Integer.MAX_VALUE, ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy).getRestartAttempts());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:RestartStrategyTest.java


示例5: testFixedRestartingWhenCheckpointingAndExplicitExecutionRetriesNonZero

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * Checks that in a streaming use case where checkpointing is enabled and the number
 * of execution retries is set to 42 and the delay to 1337, fixed delay restarting is used.
 */
@Test
public void testFixedRestartingWhenCheckpointingAndExplicitExecutionRetriesNonZero() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
	env.enableCheckpointing(500);
	env.setNumberOfExecutionRetries(42);
	env.getConfig().setExecutionRetryDelay(1337);

	env.fromElements(1).print();

	StreamGraph graph = env.getStreamGraph();
	JobGraph jobGraph = graph.getJobGraph();

	RestartStrategies.RestartStrategyConfiguration restartStrategy =
		jobGraph.getSerializedExecutionConfig().deserializeValue(getClass().getClassLoader()).getRestartStrategy();

	Assert.assertNotNull(restartStrategy);
	Assert.assertTrue(restartStrategy instanceof RestartStrategies.FixedDelayRestartStrategyConfiguration);
	Assert.assertEquals(42, ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy).getRestartAttempts());
	Assert.assertEquals(1337, ((RestartStrategies.FixedDelayRestartStrategyConfiguration) restartStrategy).getDelayBetweenAttemptsInterval().toMilliseconds());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:RestartStrategyTest.java


示例6: createJobGraph

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
private JobGraph createJobGraph(ExecutionMode mode) {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
	env.enableCheckpointing(500, CheckpointingMode.EXACTLY_ONCE);
	env.setRestartStrategy(RestartStrategies.noRestart());
	env.setStateBackend(new MemoryStateBackend());

	switch (mode) {
		case MIGRATE:
			createMigrationJob(env);
			break;
		case RESTORE:
			createRestoredJob(env);
			break;
	}

	return StreamingJobGraphGenerator.createJobGraph(env.getStreamGraph());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:AbstractOperatorRestoreTestBase.java


示例7: setup

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@BeforeClass
public static void setup() {
	try {
		Configuration config = new Configuration();
		config.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, 4L);
		config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
		config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, NUM_SLOTS / 2);
		
		cluster = new LocalFlinkMiniCluster(config);

		cluster.start();
		
		final JobVertex jobVertex = new JobVertex("Working job vertex.");
		jobVertex.setInvokableClass(NoOpInvokable.class);
		workingJobGraph = new JobGraph("Working testing job", jobVertex);
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JobSubmissionFailsITCase.java


示例8: testNoOps

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * Tests that all operations work and don't change the state.
 */
@Test
public void testNoOps() throws Exception {
	StandaloneSubmittedJobGraphStore jobGraphs = new StandaloneSubmittedJobGraphStore();

	SubmittedJobGraph jobGraph = new SubmittedJobGraph(
			new JobGraph("testNoOps"),
			new JobInfo(ActorRef.noSender(), ListeningBehaviour.DETACHED, 0, Integer.MAX_VALUE));

	assertEquals(0, jobGraphs.getJobIds().size());

	jobGraphs.putJobGraph(jobGraph);
	assertEquals(0, jobGraphs.getJobIds().size());

	jobGraphs.removeJobGraph(jobGraph.getJobGraph().getJobID());
	assertEquals(0, jobGraphs.getJobIds().size());

	assertNull(jobGraphs.recoverJobGraph(new JobID()));
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:StandaloneSubmittedJobGraphStoreTest.java


示例9: main

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	ParameterTool params = ParameterTool.fromArgs(args);

	// define the dataflow
	StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
	env.setParallelism(2);
	env.setRestartStrategy(RestartStrategies.fixedDelayRestart(10, 1000));
	env.readFileStream("input/", 60000, FileMonitoringFunction.WatchType.ONLY_NEW_FILES)
		.addSink(new DiscardingSink<String>());

	// generate a job graph
	final JobGraph jobGraph = env.getStreamGraph().getJobGraph();
	File jobGraphFile = new File(params.get("output", "job.graph"));
	try (FileOutputStream output = new FileOutputStream(jobGraphFile);
		ObjectOutputStream obOutput = new ObjectOutputStream(output)){
		obOutput.writeObject(jobGraph);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:19,代码来源:StreamingNoop.java


示例10: execute

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@Override
public JobExecutionResult execute(String jobName) throws Exception {
	Plan plan = createProgramPlan(jobName);

	Optimizer pc = new Optimizer(new Configuration());
	OptimizedPlan op = pc.compile(plan);

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

	String jsonPlan = JsonPlanGenerator.generatePlan(jobGraph);

	// first check that the JSON is valid
	JsonParser parser = new JsonFactory().createJsonParser(jsonPlan);
	while (parser.nextToken() != null) {}

	validator.validateJson(jsonPlan);

	throw new AbortError();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:JsonJobGraphGenerationTest.java


示例11: testNodeHashIdenticalNodes

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * Tests that there are no collisions with two identical intermediate nodes connected to the
 * same predecessor.
 *
 * <pre>
 *             /-> [ (map) ] -> [ (sink) ]
 * [ (src) ] -+
 *             \-> [ (map) ] -> [ (sink) ]
 * </pre>
 */
@Test
public void testNodeHashIdenticalNodes() throws Exception {
	StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
	env.setParallelism(4);
	env.disableOperatorChaining();

	DataStream<String> src = env.addSource(new NoOpSourceFunction());

	src.map(new NoOpMapFunction()).addSink(new NoOpSinkFunction());

	src.map(new NoOpMapFunction()).addSink(new NoOpSinkFunction());

	JobGraph jobGraph = env.getStreamGraph().getJobGraph();
	Set<JobVertexID> vertexIds = new HashSet<>();
	for (JobVertex vertex : jobGraph.getVertices()) {
		assertTrue(vertexIds.add(vertex.getID()));
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:StreamingJobGraphGeneratorNodeHashTest.java


示例12: handleJsonRequest

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@Override
public CompletableFuture<String> handleJsonRequest(Map<String, String> pathParams, Map<String, String> queryParams, JobManagerGateway jobManagerGateway) {
	return CompletableFuture.supplyAsync(
		() -> {
			try {
				JarActionHandlerConfig config = JarActionHandlerConfig.fromParams(pathParams, queryParams);
				JobGraph graph = getJobGraphAndClassLoader(config).f0;
				StringWriter writer = new StringWriter();
				JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer);
				gen.writeStartObject();
				gen.writeFieldName("plan");
				gen.writeRawValue(JsonPlanGenerator.generatePlan(graph));
				gen.writeEndObject();
				gen.close();
				return writer.toString();
			}
			catch (Exception e) {
				throw new CompletionException(e);
			}
		},
		executor);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:JarPlanHandler.java


示例13: createJobManagerRunner

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
private JobManagerRunner createJobManagerRunner(Configuration config) throws Exception{
	// first get JobGraph from local resources
	//TODO: generate the job graph from user's jar
	JobGraph jobGraph = loadJobGraph(config);

	// now the JobManagerRunner
	return new JobManagerRunner(
		ResourceID.generate(),
		jobGraph,
		config,
		commonRpcService,
		haServices,
		heartbeatServices,
		this,
		this);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:YarnFlinkApplicationMasterRunner.java


示例14: executeJobBlocking

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * This method runs a job in blocking mode. The method returns only after the job
 * completed successfully, or after it failed terminally.
 *
 * @param job  The Flink job to execute 
 * @return The result of the job execution
 *
 * @throws JobExecutionException Thrown if anything went amiss during initial job launch,
 *         or if the job terminally failed.
 */
@Override
public JobExecutionResult executeJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException {
	checkNotNull(job, "job is null");

	MiniClusterJobDispatcher dispatcher;
	synchronized (lock) {
		checkState(running, "mini cluster is not running");
		dispatcher = this.jobDispatcher;
	}

	// we have to allow queued scheduling in Flip-6 mode because we need to request slots
	// from the ResourceManager
	job.setAllowQueuedScheduling(true);

	return dispatcher.runJobBlocking(job);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:MiniCluster.java


示例15: runJobBlocking

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
/**
 * This method runs a job in blocking mode. The method returns only after the job
 * completed successfully, or after it failed terminally.
 *
 * @param job  The Flink job to execute 
 * @return The result of the job execution
 *
 * @throws JobExecutionException Thrown if anything went amiss during initial job launch,
 *         or if the job terminally failed.
 */
public JobExecutionResult runJobBlocking(JobGraph job) throws JobExecutionException, InterruptedException {
	checkNotNull(job);
	
	LOG.info("Received job for blocking execution: {} ({})", job.getName(), job.getJobID());
	final BlockingJobSync sync = new BlockingJobSync(job.getJobID(), numJobManagers);

	synchronized (lock) {
		checkState(!shutdown, "mini cluster is shut down");
		checkState(runners == null, "mini cluster can only execute one job at a time");

		this.runners = startJobRunners(job, sync, sync);
	}

	try {
		return sync.getResult();
	}
	finally {
		// always clear the status for the next job
		runners = null;
		clearJobRunningState(job.getJobID());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:33,代码来源:MiniClusterJobDispatcher.java


示例16: StreamingJobGraphGenerator

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
private StreamingJobGraphGenerator(StreamGraph streamGraph) {
	this.streamGraph = streamGraph;
	this.defaultStreamGraphHasher = new StreamGraphHasherV2();
	this.legacyStreamGraphHashers = Arrays.asList(new StreamGraphUserHashHasher());

	this.jobVertices = new HashMap<>();
	this.builtVertices = new HashSet<>();
	this.chainedConfigs = new HashMap<>();
	this.vertexConfigs = new HashMap<>();
	this.chainedNames = new HashMap<>();
	this.chainedMinResources = new HashMap<>();
	this.chainedPreferredResources = new HashMap<>();
	this.physicalEdgesInOrder = new ArrayList<>();

	jobGraph = new JobGraph(streamGraph.getJobName());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:StreamingJobGraphGenerator.java


示例17: createJobManagerRunner

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
@Override
protected JobManagerRunner createJobManagerRunner(
		ResourceID resourceId,
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerServices jobManagerServices,
		MetricRegistry metricRegistry,
		OnCompletionActions onCompleteActions,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	// create the standard job manager runner
	return new JobManagerRunner(
		resourceId,
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerServices,
		metricRegistry,
		onCompleteActions,
		fatalErrorHandler,
		restAddress);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:StandaloneDispatcher.java


示例18: createJobManagerRunner

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
protected JobManagerRunner createJobManagerRunner(
		Configuration configuration,
		ResourceID resourceId,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		JobManagerServices jobManagerServices,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		FatalErrorHandler fatalErrorHandler,
		@Nullable String restAddress) throws Exception {

	final JobGraph jobGraph = retrieveJobGraph(configuration);

	return new JobManagerRunner(
		resourceId,
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerServices,
		metricRegistry,
		new TerminatingOnCompleteActions(jobGraph.getJobID()),
		fatalErrorHandler,
		restAddress);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:JobClusterEntrypoint.java


示例19: createBlockingJob

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
public JobGraph createBlockingJob(int parallelism) {
	Tasks.BlockingOnceReceiver$.MODULE$.blocking_$eq(true);

	JobVertex sender = new JobVertex("sender");
	JobVertex receiver = new JobVertex("receiver");

	sender.setInvokableClass(Tasks.Sender.class);
	receiver.setInvokableClass(Tasks.BlockingOnceReceiver.class);

	sender.setParallelism(parallelism);
	receiver.setParallelism(parallelism);

	receiver.connectNewDataSetAsInput(sender, DistributionPattern.POINTWISE, ResultPartitionType.PIPELINED);

	SlotSharingGroup slotSharingGroup = new SlotSharingGroup();
	sender.setSlotSharingGroup(slotSharingGroup);
	receiver.setSlotSharingGroup(slotSharingGroup);

	return new JobGraph("Blocking test job", sender, receiver);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:LeaderChangeStateCleanupTest.java


示例20: getSimpleJob

import org.apache.flink.runtime.jobgraph.JobGraph; //导入依赖的package包/类
private static JobGraph getSimpleJob() throws IOException {
	JobVertex task = new JobVertex("Test task");
	task.setParallelism(1);
	task.setMaxParallelism(1);
	task.setInvokableClass(NoOpInvokable.class);

	JobGraph jg = new JobGraph(new JobID(), "Test Job", task);
	jg.setAllowQueuedScheduling(true);
	jg.setScheduleMode(ScheduleMode.EAGER);

	ExecutionConfig executionConfig = new ExecutionConfig();
	executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 1000));
	jg.setExecutionConfig(executionConfig);

	return jg;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:MiniClusterITCase.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PairConsumer类代码示例发布时间:2022-05-22
下一篇:
Java InetAddressSerializer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap