You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by ra...@apache.org on 2019/07/31 19:05:23 UTC

[samza] branch master updated: Adding method to enable ContainerLaunchUtil to work with current BeamContainerRunner (#1120)

This is an automated email from the ASF dual-hosted git repository.

rayman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git


The following commit(s) were added to refs/heads/master by this push:
     new 1e6f1fd  Adding method to enable ContainerLaunchUtil to work with current BeamContainerRunner (#1120)
1e6f1fd is described below

commit 1e6f1fd6ffd1103474afe59413b7816baa061286
Author: rmatharu <40...@users.noreply.github.com>
AuthorDate: Wed Jul 31 12:05:17 2019 -0700

    Adding method to enable ContainerLaunchUtil to work with current BeamContainerRunner (#1120)
---
 .../java/org/apache/samza/runtime/ContainerLaunchUtil.java | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/samza-core/src/main/java/org/apache/samza/runtime/ContainerLaunchUtil.java b/samza-core/src/main/java/org/apache/samza/runtime/ContainerLaunchUtil.java
index c84a4a1..ee69caf 100644
--- a/samza-core/src/main/java/org/apache/samza/runtime/ContainerLaunchUtil.java
+++ b/samza-core/src/main/java/org/apache/samza/runtime/ContainerLaunchUtil.java
@@ -27,6 +27,7 @@ import org.apache.samza.SamzaException;
 import org.apache.samza.application.descriptors.ApplicationDescriptor;
 import org.apache.samza.application.descriptors.ApplicationDescriptorImpl;
 import org.apache.samza.config.Config;
+import org.apache.samza.config.JobConfig;
 import org.apache.samza.config.MetricsConfig;
 import org.apache.samza.config.ShellCommandConfig;
 import org.apache.samza.container.ContainerHeartbeatClient;
@@ -61,11 +62,18 @@ public class ContainerLaunchUtil {
   private static volatile Throwable containerRunnerException = null;
 
   /**
-   * This method launches a Samza container in a managed cluster, e.g. Yarn.
-   *
-   * NOTE: this util method is also invoked by Beam SamzaRunner.
+   * This method launches a Samza container in a managed cluster and is invoked by BeamContainerRunner.
    * Any change here needs to take Beam into account.
    */
+  public static void run(ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc,  String containerId, JobModel jobModel) {
+    Optional<String> execEnvContainerId = Optional.ofNullable(System.getenv(ShellCommandConfig.ENV_EXECUTION_ENV_CONTAINER_ID()));
+    JobConfig jobConfig = new JobConfig(jobModel.getConfig());
+    ContainerLaunchUtil.run(appDesc, jobConfig.getName().get(), jobConfig.getJobId(), containerId, execEnvContainerId, jobModel);
+  }
+
+  /**
+   * This method launches a Samza container in a managed cluster, e.g. Yarn.
+   */
   public static void run(
       ApplicationDescriptorImpl<? extends ApplicationDescriptor> appDesc,
       String jobName, String jobId, String containerId, Optional<String> execEnvContainerId,