Search in sources :

Example 1 with DataflowPipelineWorkerPoolOptions

use of org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions in project beam by apache.

the class DataflowRunnerTest method testAliasForSdkContainerImage.

@Test
public void testAliasForSdkContainerImage() {
    DataflowPipelineWorkerPoolOptions options = PipelineOptionsFactory.as(DataflowPipelineWorkerPoolOptions.class);
    String testImage = "image.url:sdk";
    options.setSdkContainerImage("image.url:sdk");
    DataflowRunner.validateWorkerSettings(options);
    assertEquals(testImage, options.getWorkerHarnessContainerImage());
    assertEquals(testImage, options.getSdkContainerImage());
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) DataflowPipelineWorkerPoolOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with DataflowPipelineWorkerPoolOptions

use of org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions in project beam by apache.

the class DataflowRunnerTest method testExperimentRegionAndWorkerRegionMutuallyExclusive.

@Test
public void testExperimentRegionAndWorkerRegionMutuallyExclusive() {
    DataflowPipelineWorkerPoolOptions options = PipelineOptionsFactory.as(DataflowPipelineWorkerPoolOptions.class);
    DataflowPipelineOptions dataflowOptions = options.as(DataflowPipelineOptions.class);
    ExperimentalOptions.addExperiment(dataflowOptions, "worker_region=us-west1");
    options.setWorkerRegion("us-east1");
    assertThrows(IllegalArgumentException.class, () -> DataflowRunner.validateWorkerSettings(options));
}
Also used : DataflowPipelineOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineOptions) DataflowPipelineWorkerPoolOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with DataflowPipelineWorkerPoolOptions

use of org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions in project beam by apache.

the class DataflowRunnerTest method testWorkerRegionAndWorkerZoneMutuallyExclusive.

@Test
public void testWorkerRegionAndWorkerZoneMutuallyExclusive() {
    DataflowPipelineWorkerPoolOptions options = PipelineOptionsFactory.as(DataflowPipelineWorkerPoolOptions.class);
    options.setWorkerRegion("us-east1");
    options.setWorkerZone("us-east1-b");
    assertThrows(IllegalArgumentException.class, () -> DataflowRunner.validateWorkerSettings(options));
}
Also used : DataflowPipelineWorkerPoolOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with DataflowPipelineWorkerPoolOptions

use of org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions in project beam by apache.

the class DataflowRunnerTest method testExperimentRegionAndWorkerZoneMutuallyExclusive.

@Test
public void testExperimentRegionAndWorkerZoneMutuallyExclusive() {
    DataflowPipelineWorkerPoolOptions options = PipelineOptionsFactory.as(DataflowPipelineWorkerPoolOptions.class);
    DataflowPipelineOptions dataflowOptions = options.as(DataflowPipelineOptions.class);
    ExperimentalOptions.addExperiment(dataflowOptions, "worker_region=us-west1");
    options.setWorkerZone("us-east1-b");
    assertThrows(IllegalArgumentException.class, () -> DataflowRunner.validateWorkerSettings(options));
}
Also used : DataflowPipelineOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineOptions) DataflowPipelineWorkerPoolOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with DataflowPipelineWorkerPoolOptions

use of org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions in project beam by apache.

the class DataflowRunnerTest method testAliasForLegacyWorkerHarnessContainerImage.

@Test
public void testAliasForLegacyWorkerHarnessContainerImage() {
    DataflowPipelineWorkerPoolOptions options = PipelineOptionsFactory.as(DataflowPipelineWorkerPoolOptions.class);
    String testImage = "image.url:worker";
    options.setWorkerHarnessContainerImage(testImage);
    DataflowRunner.validateWorkerSettings(options);
    assertEquals(testImage, options.getWorkerHarnessContainerImage());
    assertEquals(testImage, options.getSdkContainerImage());
}
Also used : Matchers.containsString(org.hamcrest.Matchers.containsString) DataflowPipelineWorkerPoolOptions(org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

DataflowPipelineWorkerPoolOptions (org.apache.beam.runners.dataflow.options.DataflowPipelineWorkerPoolOptions)8 Test (org.junit.Test)8 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)8 DataflowPipelineOptions (org.apache.beam.runners.dataflow.options.DataflowPipelineOptions)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2