mynameborat commented on a change in pull request #14554:
URL: https://github.com/apache/beam/pull/14554#discussion_r617035955



##########
File path: 
runners/samza/src/main/java/org/apache/beam/runners/samza/SamzaJobInvoker.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.samza;
+
+import java.util.UUID;
+import javax.annotation.Nullable;
+import org.apache.beam.model.pipeline.v1.RunnerApi;
+import org.apache.beam.runners.core.construction.PipelineOptionsTranslation;
+import org.apache.beam.runners.fnexecution.provisioning.JobInfo;
+import org.apache.beam.runners.jobsubmission.JobInvocation;
+import org.apache.beam.runners.jobsubmission.JobInvoker;
+import org.apache.beam.runners.jobsubmission.PortablePipelineJarCreator;
+import org.apache.beam.runners.jobsubmission.PortablePipelineRunner;
+import org.apache.beam.sdk.options.PortablePipelineOptions;
+import org.apache.beam.vendor.grpc.v1p26p0.com.google.protobuf.Struct;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Strings;
+import 
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.ListeningExecutorService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({
+  "nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
+})
+public class SamzaJobInvoker extends JobInvoker {
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(SamzaJobInvoker.class);
+  private final SamzaJobServerDriver.SamzaServerConfiguration configuration;
+
+  public static SamzaJobInvoker create(
+      SamzaJobServerDriver.SamzaServerConfiguration configuration) {
+    return new SamzaJobInvoker(configuration);
+  }
+
+  private SamzaJobInvoker(SamzaJobServerDriver.SamzaServerConfiguration 
configuration) {
+    super("samza-runner-job-invoker-%d");
+    this.configuration = configuration;
+  }
+
+  @Override
+  protected JobInvocation invokeWithExecutor(
+      RunnerApi.Pipeline pipeline,
+      Struct options,
+      @Nullable String retrievalToken,
+      ListeningExecutorService executorService) {
+    LOG.trace("Parsing pipeline options");
+    final SamzaPortablePipelineOptions samzaOptions =
+        
PipelineOptionsTranslation.fromProto(options).as(SamzaPortablePipelineOptions.class);
+    // Options can't be translated to proto if runner class is unresolvable, 
so set it to null.
+    samzaOptions.setRunner(null);

Review comment:
       The submission doesn't need to serialize the options again as we don't 
make any changes to options as is; We should be able to pass the `options` that 
was passed as part of the `invokeWithExecutor` back to the job submission. 




-- 
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