Search in sources :

Example 6 with LocalFlinkMiniCluster

use of org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster in project flink by apache.

the class NotSoMiniClusterIterations method main.

public static void main(String[] args) {
    if ((Runtime.getRuntime().maxMemory() >>> 20) < 5000) {
        throw new RuntimeException("This test program needs to run with at least 5GB of heap space.");
    }
    LocalFlinkMiniCluster cluster = null;
    try {
        Configuration config = new Configuration();
        config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, PARALLELISM);
        config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 8);
        config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 1);
        config.setInteger(ConfigConstants.TASK_MANAGER_NETWORK_NUM_BUFFERS_KEY, 1000);
        config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SEGMENT_SIZE_KEY, 8 * 1024);
        config.setInteger("taskmanager.net.server.numThreads", 1);
        config.setInteger("taskmanager.net.client.numThreads", 1);
        cluster = new LocalFlinkMiniCluster(config, false);
        cluster.start();
        runConnectedComponents(cluster.getLeaderRPCPort());
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    } finally {
        if (cluster != null) {
            cluster.shutdown();
        }
    }
}
Also used : Configuration(org.apache.flink.configuration.Configuration) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster)

Example 7 with LocalFlinkMiniCluster

use of org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster in project flink by apache.

the class StreamingScalabilityAndLatency method main.

public static void main(String[] args) throws Exception {
    if ((Runtime.getRuntime().maxMemory() >>> 20) < 5000) {
        throw new RuntimeException("This test program needs to run with at least 5GB of heap space.");
    }
    final int TASK_MANAGERS = 1;
    final int SLOTS_PER_TASK_MANAGER = 80;
    final int PARALLELISM = TASK_MANAGERS * SLOTS_PER_TASK_MANAGER;
    LocalFlinkMiniCluster cluster = null;
    try {
        Configuration config = new Configuration();
        config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, TASK_MANAGERS);
        config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 80);
        config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, SLOTS_PER_TASK_MANAGER);
        config.setInteger(ConfigConstants.TASK_MANAGER_NETWORK_NUM_BUFFERS_KEY, 20000);
        config.setInteger("taskmanager.net.server.numThreads", 1);
        config.setInteger("taskmanager.net.client.numThreads", 1);
        cluster = new LocalFlinkMiniCluster(config, false);
        cluster.start();
        runPartitioningProgram(cluster.getLeaderRPCPort(), PARALLELISM);
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    } finally {
        if (cluster != null) {
            cluster.shutdown();
        }
    }
}
Also used : Configuration(org.apache.flink.configuration.Configuration) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster)

Example 8 with LocalFlinkMiniCluster

use of org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster in project flink by apache.

the class AutoParallelismITCase method setupCluster.

@BeforeClass
public static void setupCluster() {
    Configuration config = new Configuration();
    config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, NUM_TM);
    config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, SLOTS_PER_TM);
    cluster = new LocalFlinkMiniCluster(config, false);
    cluster.start();
}
Also used : Configuration(org.apache.flink.configuration.Configuration) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster) BeforeClass(org.junit.BeforeClass)

Example 9 with LocalFlinkMiniCluster

use of org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster in project flink by apache.

the class MiscellaneousIssuesITCase method startCluster.

@BeforeClass
public static void startCluster() {
    try {
        Configuration config = new Configuration();
        config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
        config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 3);
        config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 12);
        cluster = new LocalFlinkMiniCluster(config, false);
        cluster.start();
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed to start test cluster: " + e.getMessage());
    }
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ProgramInvocationException(org.apache.flink.client.program.ProgramInvocationException) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster) BeforeClass(org.junit.BeforeClass)

Example 10 with LocalFlinkMiniCluster

use of org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster in project flink by apache.

the class SuccessAfterNetworkBuffersFailureITCase method testSuccessfulProgramAfterFailure.

@Test
public void testSuccessfulProgramAfterFailure() {
    LocalFlinkMiniCluster cluster = null;
    try {
        Configuration config = new Configuration();
        config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
        config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 80);
        config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 8);
        config.setInteger(ConfigConstants.TASK_MANAGER_NETWORK_NUM_BUFFERS_KEY, 840);
        cluster = new LocalFlinkMiniCluster(config, false);
        cluster.start();
        try {
            runConnectedComponents(cluster.getLeaderRPCPort());
        } catch (Exception e) {
            e.printStackTrace();
            fail("Program Execution should have succeeded.");
        }
        try {
            runKMeans(cluster.getLeaderRPCPort());
            fail("This program execution should have failed.");
        } catch (ProgramInvocationException e) {
            assertTrue(e.getCause().getCause().getMessage().contains("Insufficient number of network buffers"));
        }
        try {
            runConnectedComponents(cluster.getLeaderRPCPort());
        } catch (Exception e) {
            e.printStackTrace();
            fail("Program Execution should have succeeded.");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    } finally {
        if (cluster != null) {
            cluster.shutdown();
        }
    }
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ProgramInvocationException(org.apache.flink.client.program.ProgramInvocationException) ProgramInvocationException(org.apache.flink.client.program.ProgramInvocationException) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster) Test(org.junit.Test)

Aggregations

LocalFlinkMiniCluster (org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster)39 Configuration (org.apache.flink.configuration.Configuration)36 BeforeClass (org.junit.BeforeClass)19 Test (org.junit.Test)9 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)5 ProgramInvocationException (org.apache.flink.client.program.ProgramInvocationException)4 ActorGateway (org.apache.flink.runtime.instance.ActorGateway)4 File (java.io.File)3 IOException (java.io.IOException)3 Properties (java.util.Properties)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)3 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)3 JobManagerMessages (org.apache.flink.runtime.messages.JobManagerMessages)3 FiniteDuration (scala.concurrent.duration.FiniteDuration)3 ActorSystem (akka.actor.ActorSystem)2 AmazonKinesisClient (com.amazonaws.services.kinesis.AmazonKinesisClient)2 DescribeStreamResult (com.amazonaws.services.kinesis.model.DescribeStreamResult)2 HashSet (java.util.HashSet)2 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)2 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)2