aaltay commented on a change in pull request #14575:
URL: https://github.com/apache/beam/pull/14575#discussion_r617957431



##########
File path: 
runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java
##########
@@ -401,8 +402,34 @@ static boolean isServiceEndpoint(String endpoint) {
     return Strings.isNullOrEmpty(endpoint) || Pattern.matches(ENDPOINT_REGEXP, 
endpoint);
   }
 
+  static void 
validateSdkContainerImageOptions(DataflowPipelineWorkerPoolOptions 
workerOptions) {
+    // Check against null - empty string value for workerHarnessContainerImage
+    // must be preserved for legacy dataflowWorkerJar to work.
+    Preconditions.checkArgument(
+        workerOptions.getWorkerHarnessContainerImage() == null
+            || workerOptions.getSdkContainerImage() == null
+            || workerOptions
+                .getWorkerHarnessContainerImage()
+                .equals(workerOptions.getSdkContainerImage()),
+        "Cannot use legacy option workerHarnessContainerImage with 
sdkContainerImage. Prefer sdkContainerImage.");
+
+    // Make sure the values are the same for legacy flag and current flag.
+    if (workerOptions.getSdkContainerImage() != null) {
+      
workerOptions.setWorkerHarnessContainerImage(workerOptions.getSdkContainerImage());
+    } else if (workerOptions.getWorkerHarnessContainerImage() != null) {

Review comment:
       You are both absolutely right :) And thanks for improving the 
readability.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to