use of org.apache.flink.runtime.minicluster.MiniClusterConfiguration in project flink by apache.
the class ShuffleMasterTest method createClusterConfiguration.
private MiniClusterConfiguration createClusterConfiguration(boolean stopTrackingPartition) {
Configuration configuration = new Configuration();
configuration.setString(ShuffleServiceOptions.SHUFFLE_SERVICE_FACTORY_CLASS, TestShuffleServiceFactory.class.getName());
configuration.setString(RestOptions.BIND_PORT, "0");
configuration.setBoolean(STOP_TRACKING_PARTITION_KEY, stopTrackingPartition);
return new MiniClusterConfiguration.Builder().setNumTaskManagers(1).setNumSlotsPerTaskManager(1).setConfiguration(configuration).build();
}
use of org.apache.flink.runtime.minicluster.MiniClusterConfiguration in project flink by apache.
the class CoordinatorEventsExactlyOnceITCase method startMiniCluster.
@BeforeClass
public static void startMiniCluster() throws Exception {
final Configuration config = new Configuration();
config.setString(RestOptions.BIND_PORT, "0");
final MiniClusterConfiguration clusterCfg = new MiniClusterConfiguration.Builder().setNumTaskManagers(2).setNumSlotsPerTaskManager(1).setConfiguration(config).build();
miniCluster = new MiniCluster(clusterCfg);
miniCluster.start();
}
use of org.apache.flink.runtime.minicluster.MiniClusterConfiguration in project flink by apache.
the class JobGraphRunningUtil method execute.
public static void execute(JobGraph jobGraph, Configuration configuration, int numTaskManagers, int numSlotsPerTaskManager) throws Exception {
configuration.set(TaskManagerOptions.TOTAL_FLINK_MEMORY, MemorySize.parse("1g"));
configuration.setString(RestOptions.BIND_PORT, "0");
final MiniClusterConfiguration miniClusterConfiguration = new MiniClusterConfiguration.Builder().setConfiguration(configuration).setNumTaskManagers(numTaskManagers).setNumSlotsPerTaskManager(numSlotsPerTaskManager).build();
try (MiniCluster miniCluster = new MiniCluster(miniClusterConfiguration)) {
miniCluster.start();
MiniClusterClient miniClusterClient = new MiniClusterClient(configuration, miniCluster);
// wait for the submission to succeed
JobID jobID = miniClusterClient.submitJob(jobGraph).get();
JobResult jobResult = miniClusterClient.requestJobResult(jobID).get();
if (jobResult.getSerializedThrowable().isPresent()) {
throw new AssertionError(jobResult.getSerializedThrowable().get());
}
}
}
use of org.apache.flink.runtime.minicluster.MiniClusterConfiguration in project flink by apache.
the class PipelinedRegionSchedulingITCase method executeSchedulingTest.
private JobResult executeSchedulingTest(JobGraph jobGraph, int numSlots, Configuration configuration) throws Exception {
configuration.setString(RestOptions.BIND_PORT, "0");
configuration.setLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT, 5000L);
final MiniClusterConfiguration miniClusterConfiguration = new MiniClusterConfiguration.Builder().setConfiguration(configuration).setNumTaskManagers(1).setNumSlotsPerTaskManager(numSlots).build();
try (MiniCluster miniCluster = new MiniCluster(miniClusterConfiguration)) {
miniCluster.start();
final MiniClusterClient miniClusterClient = new MiniClusterClient(configuration, miniCluster);
// wait for the submission to succeed
final JobID jobID = miniClusterClient.submitJob(jobGraph).get();
final CompletableFuture<JobResult> resultFuture = miniClusterClient.requestJobResult(jobID);
final JobResult jobResult = resultFuture.get();
return jobResult;
}
}
use of org.apache.flink.runtime.minicluster.MiniClusterConfiguration in project flink by apache.
the class SchedulingITCase method executeSchedulingTest.
private void executeSchedulingTest(Configuration configuration) throws Exception {
configuration.setString(RestOptions.BIND_PORT, "0");
final long slotIdleTimeout = 50L;
configuration.setLong(JobManagerOptions.SLOT_IDLE_TIMEOUT, slotIdleTimeout);
configuration.set(TaskManagerOptions.TOTAL_FLINK_MEMORY, MemorySize.parse("1g"));
final int parallelism = 4;
final MiniClusterConfiguration miniClusterConfiguration = new MiniClusterConfiguration.Builder().setConfiguration(configuration).setNumTaskManagers(parallelism).setNumSlotsPerTaskManager(1).build();
try (MiniCluster miniCluster = new MiniCluster(miniClusterConfiguration)) {
miniCluster.start();
MiniClusterClient miniClusterClient = new MiniClusterClient(configuration, miniCluster);
JobGraph jobGraph = createJobGraph(slotIdleTimeout << 1, parallelism);
// wait for the submission to succeed
JobID jobID = miniClusterClient.submitJob(jobGraph).get();
CompletableFuture<JobResult> resultFuture = miniClusterClient.requestJobResult(jobID);
JobResult jobResult = resultFuture.get();
assertThat(jobResult.getSerializedThrowable().isPresent(), is(false));
}
}
Aggregations