Search in sources :

Example 16 with MiniClusterConfiguration

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();
}
Also used : MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) Configuration(org.apache.flink.configuration.Configuration)

Example 17 with MiniClusterConfiguration

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();
}
Also used : MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) CheckpointCoordinatorConfiguration(org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration) Configuration(org.apache.flink.configuration.Configuration) JobGraphBuilder(org.apache.flink.runtime.jobgraph.JobGraphBuilder) MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) MiniCluster(org.apache.flink.runtime.minicluster.MiniCluster) BeforeClass(org.junit.BeforeClass)

Example 18 with MiniClusterConfiguration

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());
        }
    }
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) MiniCluster(org.apache.flink.runtime.minicluster.MiniCluster) MiniClusterClient(org.apache.flink.client.program.MiniClusterClient) JobID(org.apache.flink.api.common.JobID)

Example 19 with MiniClusterConfiguration

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;
    }
}
Also used : JobResult(org.apache.flink.runtime.jobmaster.JobResult) RecordWriterBuilder(org.apache.flink.runtime.io.network.api.writer.RecordWriterBuilder) MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) MiniCluster(org.apache.flink.runtime.minicluster.MiniCluster) MiniClusterClient(org.apache.flink.client.program.MiniClusterClient) JobID(org.apache.flink.api.common.JobID)

Example 20 with MiniClusterConfiguration

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));
    }
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobResult(org.apache.flink.runtime.jobmaster.JobResult) JobGraphBuilder(org.apache.flink.runtime.jobgraph.JobGraphBuilder) MiniClusterConfiguration(org.apache.flink.runtime.minicluster.MiniClusterConfiguration) MiniCluster(org.apache.flink.runtime.minicluster.MiniCluster) MiniClusterClient(org.apache.flink.client.program.MiniClusterClient) JobID(org.apache.flink.api.common.JobID)

Aggregations

MiniClusterConfiguration (org.apache.flink.runtime.minicluster.MiniClusterConfiguration)20 Configuration (org.apache.flink.configuration.Configuration)16 MiniCluster (org.apache.flink.runtime.minicluster.MiniCluster)15 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)8 BeforeClass (org.junit.BeforeClass)5 JobID (org.apache.flink.api.common.JobID)4 MiniClusterClient (org.apache.flink.client.program.MiniClusterClient)4 Test (org.junit.Test)4 JobGraphBuilder (org.apache.flink.runtime.jobgraph.JobGraphBuilder)3 JobResult (org.apache.flink.runtime.jobmaster.JobResult)3 RecordWriterBuilder (org.apache.flink.runtime.io.network.api.writer.RecordWriterBuilder)2 URI (java.net.URI)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Function (java.util.function.Function)1 ConfigConstants (org.apache.flink.configuration.ConfigConstants)1 RestOptions (org.apache.flink.configuration.RestOptions)1 TaskManagerOptions (org.apache.flink.configuration.TaskManagerOptions)1 UnmodifiableConfiguration (org.apache.flink.configuration.UnmodifiableConfiguration)1