Search in sources :

Example 1 with Operator

use of org.apache.flink.api.java.operators.Operator in project flink by apache.

the class OperatorTest method testConfigurationOfParallelism.

@Test
public void testConfigurationOfParallelism() {
    Operator operator = new MockOperator();
    // verify explicit change in parallelism
    int parallelism = 36;
    operator.setParallelism(parallelism);
    assertEquals(parallelism, operator.getParallelism());
    // verify that parallelism is reset to default flag value
    parallelism = ExecutionConfig.PARALLELISM_DEFAULT;
    operator.setParallelism(parallelism);
    assertEquals(parallelism, operator.getParallelism());
}
Also used : Operator(org.apache.flink.api.java.operators.Operator) Test(org.junit.Test)

Example 2 with Operator

use of org.apache.flink.api.java.operators.Operator in project flink by apache.

the class OperatorTest method testConfigurationOfResource.

@Test
public void testConfigurationOfResource() throws Exception {
    Operator operator = new MockOperator();
    Method opMethod = Operator.class.getDeclaredMethod("setResources", ResourceSpec.class, ResourceSpec.class);
    opMethod.setAccessible(true);
    // verify explicit change in resources
    ResourceSpec minResources = ResourceSpec.newBuilder(1.0, 100).build();
    ResourceSpec preferredResources = ResourceSpec.newBuilder(2.0, 200).build();
    opMethod.invoke(operator, minResources, preferredResources);
    assertEquals(minResources, operator.getMinResources());
    assertEquals(preferredResources, operator.getPreferredResources());
}
Also used : Operator(org.apache.flink.api.java.operators.Operator) ResourceSpec(org.apache.flink.api.common.operators.ResourceSpec) Method(java.lang.reflect.Method) Test(org.junit.Test)

Aggregations

Operator (org.apache.flink.api.java.operators.Operator)2 Test (org.junit.Test)2 Method (java.lang.reflect.Method)1 ResourceSpec (org.apache.flink.api.common.operators.ResourceSpec)1