本文整理汇总了Java中org.apache.flink.runtime.jobgraph.JobGraph.setAllowQueuedScheduling方法的典型用法代码示例。如果您正苦于以下问题:Java JobGraph.setAllowQueuedScheduling方法的具体用法?Java JobGraph.setAllowQueuedScheduling怎么用?Java JobGraph.setAllowQueuedScheduling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.runtime.jobgraph.JobGraph
的用法示例。
在下文中一共展示了JobGraph.setAllowQueuedScheduling方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: createTestJobGraph
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
private JobGraph createTestJobGraph(
String jobName,
int senderParallelism,
int receiverParallelism) {
// The sender and receiver invokable logic ensure that each subtask gets the expected data
final JobVertex sender = new JobVertex("Sender");
sender.setInvokableClass(RoundRobinSubtaskIndexSender.class);
sender.getConfiguration().setInteger(RoundRobinSubtaskIndexSender.CONFIG_KEY, receiverParallelism);
sender.setParallelism(senderParallelism);
final JobVertex receiver = new JobVertex("Receiver");
receiver.setInvokableClass(SubtaskIndexReceiver.class);
receiver.getConfiguration().setInteger(SubtaskIndexReceiver.CONFIG_KEY, senderParallelism);
receiver.setParallelism(receiverParallelism);
receiver.connectNewDataSetAsInput(
sender,
DistributionPattern.ALL_TO_ALL,
ResultPartitionType.BLOCKING);
final JobGraph jobGraph = new JobGraph(jobName, sender, receiver);
// We need to allow queued scheduling, because there are not enough slots available
// to run all tasks at once. We queue tasks and then let them finish/consume the blocking
// result one after the other.
jobGraph.setAllowQueuedScheduling(true);
return jobGraph;
}
示例4: execute
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
/**
* Executes the JobGraph of the on a mini cluster of CLusterUtil with a user
* specified name.
*
* @param jobName
* name of the job
* @return The result of the job execution, containing elapsed time and accumulators.
*/
@Override
public JobExecutionResult execute(String jobName) throws Exception {
// transform the streaming program into a JobGraph
StreamGraph streamGraph = getStreamGraph();
streamGraph.setJobName(jobName);
JobGraph jobGraph = streamGraph.getJobGraph();
jobGraph.setAllowQueuedScheduling(true);
Configuration configuration = new Configuration();
configuration.addAll(jobGraph.getJobConfiguration());
configuration.setLong(TaskManagerOptions.MANAGED_MEMORY_SIZE, -1L);
// add (and override) the settings with what the user defined
configuration.addAll(this.conf);
MiniClusterConfiguration cfg = new MiniClusterConfiguration.Builder()
.setConfiguration(configuration)
.setNumSlotsPerTaskManager(jobGraph.getMaximumParallelism())
.build();
if (LOG.isInfoEnabled()) {
LOG.info("Running job on local embedded Flink mini cluster");
}
MiniCluster miniCluster = new MiniCluster(cfg);
try {
miniCluster.start();
return miniCluster.executeJobBlocking(jobGraph);
}
finally {
transformations.clear();
miniCluster.shutdown();
}
}
示例5: setUp
import org.apache.flink.runtime.jobgraph.JobGraph; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
final JobVertex testVertex = new JobVertex("testVertex");
testVertex.setInvokableClass(NoOpInvokable.class);
jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex);
jobGraph.setAllowQueuedScheduling(true);
fatalErrorHandler = new TestingFatalErrorHandler();
final HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, 10000L);
submittedJobGraphStore = spy(new InMemorySubmittedJobGraphStore());
dispatcherLeaderElectionService = new TestingLeaderElectionService();
jobMasterLeaderElectionService = new TestingLeaderElectionService();
final TestingHighAvailabilityServices haServices = new TestingHighAvailabilityServices();
haServices.setDispatcherLeaderElectionService(dispatcherLeaderElectionService);
haServices.setSubmittedJobGraphStore(submittedJobGraphStore);
haServices.setJobMasterLeaderElectionService(TEST_JOB_ID, jobMasterLeaderElectionService);
haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());
haServices.setResourceManagerLeaderRetriever(new TestingLeaderRetrievalService());
runningJobsRegistry = haServices.getRunningJobsRegistry();
final Configuration blobServerConfig = new Configuration();
blobServerConfig.setString(
BlobServerOptions.STORAGE_DIRECTORY,
temporaryFolder.newFolder().getAbsolutePath());
dispatcher = new TestingDispatcher(
rpcService,
Dispatcher.DISPATCHER_NAME + '_' + name.getMethodName(),
new Configuration(),
haServices,
mock(ResourceManagerGateway.class),
new BlobServer(blobServerConfig, new VoidBlobStore()),
heartbeatServices,
NoOpMetricRegistry.INSTANCE,
fatalErrorHandler,
TEST_JOB_ID);
dispatcher.start();
}