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


Java JobGraph.setExecutionConfig方法代码示例

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


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

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

示例2: testFailExecutionGraphAfterCancel

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Tests that it is possible to fail a graph via a call to
 * {@link ExecutionGraph#failGlobal(Throwable)} after cancellation.
 */
@Test
public void testFailExecutionGraphAfterCancel() throws Exception {
	Instance instance = ExecutionGraphTestUtils.getInstance(
		new ActorTaskManagerGateway(
			new SimpleActorGateway(TestingUtils.directExecutionContext())),
		2);

	Scheduler scheduler = new Scheduler(TestingUtils.defaultExecutionContext());
	scheduler.newInstanceAvailable(instance);

	JobVertex vertex = newJobVertex("Test Vertex", 1, NoOpInvokable.class);

	ExecutionConfig executionConfig = new ExecutionConfig();
	executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(
		Integer.MAX_VALUE, Integer.MAX_VALUE));
	JobGraph jobGraph = new JobGraph("Test Job", vertex);
	jobGraph.setExecutionConfig(executionConfig);

	ExecutionGraph eg = newExecutionGraph(new InfiniteDelayRestartStrategy(), scheduler);

	eg.attachJobGraph(jobGraph.getVerticesSortedTopologicallyFromSources());

	assertEquals(JobStatus.CREATED, eg.getState());

	eg.scheduleForExecution();
	assertEquals(JobStatus.RUNNING, eg.getState());

	// Fail right after cancel (for example with concurrent slot release)
	eg.cancel();
	assertEquals(JobStatus.CANCELLING, eg.getState());

	eg.failGlobal(new Exception("Test Exception"));
	assertEquals(JobStatus.FAILING, eg.getState());

	Execution execution = eg.getAllExecutionVertices().iterator().next().getCurrentExecutionAttempt();

	execution.cancelingComplete();
	assertEquals(JobStatus.RESTARTING, eg.getState());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:44,代码来源:ExecutionGraphRestartTest.java

示例3: testJobPersistencyWhenJobManagerShutdown

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Tests that the HA job is not cleaned up when the jobmanager is stopped.
 */
@Test
public void testJobPersistencyWhenJobManagerShutdown() throws Exception {
	Configuration config = ZooKeeperTestUtils.createZooKeeperHAConfig(
			ZooKeeper.getConnectString(), tempFolder.getRoot().getPath());

	// Configure the cluster
	config.setInteger(ConfigConstants.LOCAL_NUMBER_JOB_MANAGER, 1);
	config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 1);

	TestingCluster flink = new TestingCluster(config, false, false);

	try {
		final Deadline deadline = TestTimeOut.fromNow();

		// Start the JobManager and TaskManager
		flink.start(true);

		JobGraph jobGraph = createBlockingJobGraph();

		// Set restart strategy to guard against shut down races.
		// If the TM fails before the JM, it might happen that the
		// Job is failed, leading to state removal.
		ExecutionConfig ec = new ExecutionConfig();
		ec.setRestartStrategy(RestartStrategies.fixedDelayRestart(Integer.MAX_VALUE, 100));
		jobGraph.setExecutionConfig(ec);

		ActorGateway jobManager = flink.getLeaderGateway(deadline.timeLeft());

		// Submit the job
		jobManager.tell(new SubmitJob(jobGraph, ListeningBehaviour.DETACHED));

		// Wait for the job to start
		JobManagerActorTestUtils.waitForJobStatus(jobGraph.getJobID(), JobStatus.RUNNING,
				jobManager, deadline.timeLeft());
	}
	finally {
		flink.stop();
	}

	// verify that the persisted job data has not been removed from ZooKeeper when the JM has
	// been shutdown
	verifyRecoveryState(config);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:47,代码来源:JobManagerHAJobGraphRecoveryITCase.java

示例4: testFailExecutionAfterCancel

import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
 * Tests that a graph is not restarted after cancellation via a call to
 * {@link ExecutionGraph#failGlobal(Throwable)}. This can happen when a slot is
 * released concurrently with cancellation.
 */
@Test
public void testFailExecutionAfterCancel() throws Exception {
	Instance instance = ExecutionGraphTestUtils.getInstance(
		new ActorTaskManagerGateway(
			new SimpleActorGateway(TestingUtils.directExecutionContext())),
		2);

	Scheduler scheduler = new Scheduler(TestingUtils.defaultExecutionContext());
	scheduler.newInstanceAvailable(instance);

	JobVertex vertex = newJobVertex("Test Vertex", 1, NoOpInvokable.class);

	ExecutionConfig executionConfig = new ExecutionConfig();
	executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(
		Integer.MAX_VALUE, Integer.MAX_VALUE));
	JobGraph jobGraph = new JobGraph("Test Job", vertex);
	jobGraph.setExecutionConfig(executionConfig);

	ExecutionGraph eg = newExecutionGraph(new InfiniteDelayRestartStrategy(), scheduler);

	eg.attachJobGraph(jobGraph.getVerticesSortedTopologicallyFromSources());

	assertEquals(JobStatus.CREATED, eg.getState());

	eg.scheduleForExecution();
	assertEquals(JobStatus.RUNNING, eg.getState());

	// Fail right after cancel (for example with concurrent slot release)
	eg.cancel();

	for (ExecutionVertex v : eg.getAllExecutionVertices()) {
		v.getCurrentExecutionAttempt().fail(new Exception("Test Exception"));
	}

	assertEquals(JobStatus.CANCELED, eg.getTerminationFuture().get());

	Execution execution = eg.getAllExecutionVertices().iterator().next().getCurrentExecutionAttempt();

	execution.cancelingComplete();
	assertEquals(JobStatus.CANCELED, eg.getState());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:47,代码来源:ExecutionGraphRestartTest.java


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