Skip to content

Commit d8d4cfc

Browse files
authored
Updated All Externally Visible Logs/Docs from Runner V2 to Portable Runner (#38532)
* Aded portable runner to python and go runners * Removed empty if, added disable unit test for python. * Removed unnessary class in unit test * Removed unused variable * Ran formatter * Updated All Reference of Runner V2/V1 to portable runner/streaming java runner * Specified portable runner as dataflow portable runner * Updated testing logic to make things more clear * spotless * python spotless * fixed broken test * removed unnessary regex
1 parent cbab4d7 commit d8d4cfc

15 files changed

Lines changed: 109 additions & 37 deletions

File tree

runners/google-cloud-dataflow-java/arm/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ task printrunnerV2PipelineOptionsARM {
118118
dependsOn buildAndPushDockerJavaMultiarchContainer
119119

120120
doLast {
121-
println "To run a Dataflow job with runner V2 on ARM, add the following pipeline options to your command-line:"
121+
println "To run a Dataflow job with Dataflow Portable Runner on ARM, add the following pipeline options to your command-line:"
122122
println runnerV2PipelineOptionsARM.join(' ')
123123
}
124124
}

runners/google-cloud-dataflow-java/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ task printRunnerV2PipelineOptions {
431431
dependsOn buildAndPushDockerJavaContainer
432432

433433
doLast {
434-
println "To run a Dataflow job with runner V2, add the following pipeline options to your command-line:"
434+
println "To run a Dataflow job with Dataflow Portable Runner, add the following pipeline options to your command-line:"
435435
println runnerV2PipelineOptions.join(' ')
436436
println "Please delete your image upon completion with the following command:"
437437
println "docker rmi ${dockerJavaImageName}; gcloud container images delete --force-delete-tags ${dockerJavaImageName}"
@@ -471,7 +471,7 @@ def validatesRunnerStreamingConfig = [
471471
excludedTests: [
472472
// TODO(https://github.com/apache/beam/issues/21472)
473473
'org.apache.beam.sdk.transforms.GroupByKeyTest$BasicTests.testAfterProcessingTimeContinuationTriggerUsingState',
474-
// GroupIntoBatches.withShardedKey not supported on streaming runner v1
474+
// GroupIntoBatches.withShardedKey not supported on Streaming Java Runner
475475
// https://github.com/apache/beam/issues/22592
476476
'org.apache.beam.sdk.transforms.GroupIntoBatchesTest.testWithShardedKeyInGlobalWindow',
477477

@@ -570,7 +570,7 @@ createCrossLanguageValidatesRunnerTask(
570570

571571
task validatesRunnerV2 {
572572
group = "Verification"
573-
description = "Runs the ValidatesRunner tests on Dataflow Runner V2"
573+
description = "Runs the ValidatesRunner tests on Dataflow Portable Runner"
574574
dependsOn(createRunnerV2ValidatesRunnerTest(
575575
name: 'validatesRunnerV2Test',
576576
pipelineOptions: runnerV2PipelineOptions,
@@ -610,7 +610,7 @@ task validatesRunnerV2 {
610610

611611
task validatesRunnerV2Streaming {
612612
group = "Verification"
613-
description = "Runs the ValidatesRunner tests on Dataflow Runner V2 forcing streaming mode"
613+
description = "Runs the ValidatesRunner tests on Dataflow Portable Runner forcing streaming mode"
614614
dependsOn(createRunnerV2ValidatesRunnerTest(
615615
name: 'validatesRunnerV2TestStreaming',
616616
pipelineOptions: runnerV2PipelineOptions + ['--streaming', '--experiments=enable_streaming_engine'],
@@ -880,7 +880,7 @@ task postCommit {
880880

881881
task postCommitRunnerV2 {
882882
group = "Verification"
883-
description = "Various integration tests using the Dataflow runner V2."
883+
description = "Various integration tests using the Dataflow Portable Runner."
884884
dependsOn googleCloudPlatformRunnerV2IntegrationTest
885885
dependsOn coreSDKJavaRunnerV2IntegrationTest
886886
}

runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,12 +1242,12 @@ private static boolean includesTransformUpgrades(Pipeline pipeline) {
12421242
@Override
12431243
public DataflowPipelineJob run(Pipeline pipeline) {
12441244
// Multi-language pipelines and pipelines that include upgrades should automatically be upgraded
1245-
// to Runner v2.
1245+
// to Dataflow Portable Runner.
12461246
if (DataflowRunner.isMultiLanguagePipeline(pipeline) || includesTransformUpgrades(pipeline)) {
12471247
if (!useUnifiedWorker(options)) {
12481248
List<String> experiments = firstNonNull(options.getExperiments(), Collections.emptyList());
12491249
LOG.info(
1250-
"Automatically enabling Dataflow Runner v2 since the pipeline used cross-language"
1250+
"Automatically enabling Dataflow Portable Runner since the pipeline used cross-language"
12511251
+ " transforms or pipeline needed a transform upgrade.");
12521252
options.setExperiments(
12531253
ImmutableList.<String>builder().addAll(experiments).add("use_runner_v2").build());
@@ -1260,7 +1260,7 @@ public DataflowPipelineJob run(Pipeline pipeline) {
12601260
|| hasExperiment(options, "disable_portable_runner")
12611261
|| hasExperiment(options, "enable_streaming_java_runner")) {
12621262
throw new IllegalArgumentException(
1263-
"Runner V2 both disabled and enabled: at least one of ['beam_fn_api', 'use_unified_worker', 'use_runner_v2', 'use_portable_job_submission'] is set and also one of ['disable_runner_v2', 'disable_runner_v2_until_2023', 'disable_prime_runner_v2'] is set.");
1263+
"Dataflow Portable Runner both disabled and enabled: at least one of ['enable_portable_runner', 'beam_fn_api', 'use_unified_worker', 'use_runner_v2', 'use_portable_job_submission'] is set and also one of ['enable_streaming_java_runner', 'disable_portable_runner', 'disable_runner_v2', 'disable_runner_v2_until_2023', 'disable_prime_runner_v2'] is set.");
12641264
}
12651265
List<String> experiments =
12661266
new ArrayList<>(options.getExperiments()); // non-null if useUnifiedWorker is true
@@ -1374,10 +1374,13 @@ public DataflowPipelineJob run(Pipeline pipeline) {
13741374
options.as(SdkHarnessOptions.class).setPipelineProtoHash(pipelineProtoHash);
13751375

13761376
if (useUnifiedWorker(options)) {
1377-
LOG.info("Skipping v1 transform replacements since job will run on v2.");
1377+
LOG.info(
1378+
"Skipping Dataflow Streaming Java Runner transform replacements since job will run on Dataflow Portable Runner.");
13781379
} else {
1379-
// Now rewrite things to be as needed for v1 (mutates the pipeline)
1380-
// This way the job submitted is valid for v1 and v2, simultaneously
1380+
// Now rewrite things to be as needed for Dataflow Streaming Java Runner (mutates the
1381+
// pipeline)
1382+
// This way the job submitted is valid for Dataflow Streaming Java Runner and Dataflow
1383+
// Portable Runner, simultaneously
13811384
replaceV1Transforms(pipeline);
13821385
}
13831386
// Capture the SdkComponents for look up during step translations
@@ -1388,7 +1391,7 @@ public DataflowPipelineJob run(Pipeline pipeline) {
13881391
.addAllDependencies(getDefaultArtifacts())
13891392
.addAllCapabilities(Environments.getJavaCapabilities())
13901393
.build());
1391-
// No need to perform transform upgrading for the Runner v1 proto.
1394+
// No need to perform transform upgrading for the Dataflow Streaming Java Runner proto.
13921395
RunnerApi.Pipeline dataflowV1PipelineProto =
13931396
PipelineTranslation.toProto(pipeline, dataflowV1Components, true, false);
13941397

@@ -1544,7 +1547,7 @@ public DataflowPipelineJob run(Pipeline pipeline) {
15441547
options.setExperiments(experiments);
15451548
LOG.warn(
15461549
"The upload_graph experiment was specified, but it does not apply "
1547-
+ "to runner v2 jobs. Option has been automatically removed.");
1550+
+ "to Dataflow Portable Runner jobs. Option has been automatically removed.");
15481551
}
15491552

15501553
// Upload the job to GCS and remove the graph object from the API call. The graph

runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/DataflowRunnerTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,10 @@ public void testSettingConflictingEnableAndDisableExperimentsThrowsException() t
18551855
ExperimentalOptions.addExperiment(options, disabledExperiment);
18561856
Pipeline p = Pipeline.create(options);
18571857
p.apply(Create.of("A"));
1858-
assertThrows("Runner V2 both disabled and enabled", IllegalArgumentException.class, p::run);
1858+
assertThrows(
1859+
"Dataflow Portable Runner both disabled and enabled",
1860+
IllegalArgumentException.class,
1861+
p::run);
18591862
}
18601863
}
18611864
}

runners/google-cloud-dataflow-java/worker/windmill/src/main/proto/windmill.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ enum ConnectivityType {
979979
CONNECTIVITY_TYPE_DIRECTPATH = 2;
980980
}
981981

982-
// Settings to control runtime behavior of the java runner v1 user worker.
982+
// Settings to control runtime behavior of the Streaming Java Runner user worker.
983983
message UserWorkerRunnerV1Settings {
984984
optional UserWorkerGrpcFlowControlSettings flow_control_settings = 3;
985985

sdks/go/pkg/beam/runners/dataflow/dataflow.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func getJobOptions(ctx context.Context, streaming bool) (*dataflowlib.JobOptions
334334

335335
experiments := jobopts.GetExperiments()
336336
// Ensure that we enable the same set of experiments across all SDKs
337-
// for runner v2.
337+
// for Dataflow Portable Runner.
338338
var fnApiSet, v2set, uwSet, portaSubmission, seSet, wsSet bool
339339
for _, e := range experiments {
340340
if strings.Contains(e, "beam_fn_api") {
@@ -349,8 +349,9 @@ func getJobOptions(ctx context.Context, streaming bool) (*dataflowlib.JobOptions
349349
if strings.Contains(e, "use_portable_job_submission") {
350350
portaSubmission = true
351351
}
352-
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") {
353-
return nil, errors.New("detected one of the following experiments: disable_runner_v2 | disable_runner_v2_until_2023 | disable_prime_runner_v2. Disabling runner v2 is no longer supported as of Beam version 2.45.0+")
352+
// enable_portable_runner is not documented and hence wont be set by default. This will be fixed in later versions.
353+
if strings.Contains(e, "disable_runner_v2") || strings.Contains(e, "disable_runner_v2_until_2023") || strings.Contains(e, "disable_prime_runner_v2") || strings.Contains(e, "disable_portable_runner") || strings.Contains(e, "enable_streaming_java_runner") {
354+
return nil, errors.New("detected one of the following experiments: disable_runner_v2 | disable_runner_v2_until_2023 | disable_prime_runner_v2 | disable_portable_runner | enable_streaming_java_runner. Disabling Dataflow Portable Runner is no longer supported as of Beam version 2.45.0+")
354355
}
355356
}
356357
// Enable default experiments.
@@ -368,7 +369,7 @@ func getJobOptions(ctx context.Context, streaming bool) (*dataflowlib.JobOptions
368369
}
369370

370371
// Ensure that streaming specific experiments are set for streaming pipelines
371-
// since runner v2 only supports using streaming engine.
372+
// since Dataflow Portable Runner only supports using streaming engine.
372373
if streaming {
373374
if !seSet {
374375
experiments = append(experiments, "enable_streaming_engine")

sdks/go/pkg/beam/runners/dataflow/dataflow_test.go

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"flag"
2121
"reflect"
2222
"sort"
23+
"strings"
2324
"testing"
2425

2526
"github.com/apache/beam/sdks/v2/go/pkg/beam/core"
@@ -227,7 +228,7 @@ func TestGetJobOptions_NoExperimentsSetStreaming(t *testing.T) {
227228
}
228229
}
229230

230-
func TestGetJobOptions_DisableRunnerV2ExperimentsSet(t *testing.T) {
231+
func TestGetJobOptions_DisableRunnerV2ExperimentsSetFailJob(t *testing.T) {
231232
resetGlobals()
232233
*stagingLocation = "gs://testStagingLocation"
233234
*gcpopts.Project = "testProject"
@@ -238,6 +239,46 @@ func TestGetJobOptions_DisableRunnerV2ExperimentsSet(t *testing.T) {
238239

239240
if err == nil {
240241
t.Error("getJobOptions() returned error nil, want an error")
242+
} else if !strings.Contains(err.Error(), "Disabling Dataflow Portable Runner is no longer supported") {
243+
t.Errorf("getJobOptions() returned wrong error %q, want it to mention %q", err.Error(), "Disabling Dataflow Portable Runner is no longer supported")
244+
}
245+
if opts != nil {
246+
t.Errorf("getJobOptions() returned JobOptions when it should not have, got %#v, want nil", opts)
247+
}
248+
}
249+
250+
func TestGetJobOptions_DisablePortableRunnerExperimentsSetFailJob(t *testing.T) {
251+
resetGlobals()
252+
*stagingLocation = "gs://testStagingLocation"
253+
*gcpopts.Project = "testProject"
254+
*gcpopts.Region = "testRegion"
255+
*jobopts.Experiments = "disable_portable_runner"
256+
257+
opts, err := getJobOptions(context.Background(), false)
258+
259+
if err == nil {
260+
t.Error("getJobOptions() returned error nil, want an error")
261+
} else if !strings.Contains(err.Error(), "Disabling Dataflow Portable Runner is no longer supported") {
262+
t.Errorf("getJobOptions() returned wrong error %q, want it to mention %q", err.Error(), "Disabling Dataflow Portable Runner is no longer supported")
263+
}
264+
if opts != nil {
265+
t.Errorf("getJobOptions() returned JobOptions when it should not have, got %#v, want nil", opts)
266+
}
267+
}
268+
269+
func TestGetJobOptions_EnableStreamingJavaRunnerExperimentsSetFailJob(t *testing.T) {
270+
resetGlobals()
271+
*stagingLocation = "gs://testStagingLocation"
272+
*gcpopts.Project = "testProject"
273+
*gcpopts.Region = "testRegion"
274+
*jobopts.Experiments = "enable_streaming_java_runner"
275+
276+
opts, err := getJobOptions(context.Background(), false)
277+
278+
if err == nil {
279+
t.Error("getJobOptions() returned error nil, want an error")
280+
} else if !strings.Contains(err.Error(), "Disabling Dataflow Portable Runner is no longer supported") {
281+
t.Errorf("getJobOptions() returned wrong error %q, want it to mention %q", err.Error(), "Disabling Dataflow Portable Runner is no longer supported")
241282
}
242283
if opts != nil {
243284
t.Errorf("getJobOptions() returned JobOptions when it should not have, got %#v, want nil", opts)

sdks/python/apache_beam/examples/cookbook/ordered_window_elements/streaming.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _state_read_range(self, buffer_state, range_lo, range_hi):
135135

136136
def _state_clear_range(self, buffer_state, range_lo, range_hi):
137137
"""Clears a specified range of elements from the buffer state."""
138-
# TODO: Dataflow runner v2 gets stuck when MIN_TIMESTAMP is used
138+
# TODO: Dataflow Portable Runner gets stuck when MIN_TIMESTAMP is used
139139
# as the lower bound for clear_range. Investigate this further.
140140
buffer_state.clear_range(range_lo, range_hi)
141141

sdks/python/apache_beam/examples/kafkataxi/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Perform Beam runner specific setup.
6767

6868
ℹ️ Note that cross-language transforms require
6969
portable implementations of Spark/Flink/Direct runners. Dataflow requires
70-
[runner V2](https://cloud.google.com/dataflow/docs/guides/deploying-a-pipeline#dataflow-runner-v2).
70+
[Dataflow Portable Runner](https://cloud.google.com/dataflow/docs/guides/deploying-a-pipeline#dataflow-runner-v2).
7171
See [here](https://beam.apache.org/documentation/runners/dataflow/) for
7272
instructions for setting up Dataflow.
7373

sdks/python/apache_beam/io/external/xlang_bigqueryio_it_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ def test_streaming_with_fixed_num_streams(self):
563563

564564
@unittest.skip(
565565
"Streaming to the Storage Write API sink with autosharding is broken "
566-
"with Dataflow Runner V2.")
566+
"with Dataflow Portable Runner.")
567567
def test_streaming_with_auto_sharding(self):
568568
self.skip_if_not_dataflow_runner()
569569
table = 'streaming_with_auto_sharding'

0 commit comments

Comments
 (0)