You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apex.apache.org by PramodSSImmaneni <gi...@git.apache.org> on 2016/05/16 18:16:08 UTC

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

GitHub user PramodSSImmaneni opened a pull request:

    https://github.com/apache/incubator-apex-core/pull/334

    APEXCORE-458 Using the yarn configuration helper method to read the webapp address in HA scenario

    @vrozov @davidyan74 please review

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/PramodSSImmaneni/incubator-apex-core APEXCORE-458

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-apex-core/pull/334.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #334
    
----
commit 7773af3465024911b95d7e0ad7cd83b3faed94f9
Author: Pramod Immaneni <pr...@datatorrent.com>
Date:   2016-05-16T18:13:17Z

    APEXCORE-458 Using the yarn configuration helper method to read the rm webapp address in HA scenarios as it will fallback to the hostname if the webapp address is unavailable.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by PramodSSImmaneni <gi...@git.apache.org>.
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63575363
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    --- End diff --
    
    Good point, yes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-apex-core/pull/334


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by davidyan74 <gi...@git.apache.org>.
Github user davidyan74 commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63443931
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    +    if (isHA) {
    +      conf = getYarnConfiguration(conf);
    +      conf.set(ConfigUtils.RM_HA_ID, rmId);
    +    }
         InetSocketAddress address;
         if (sslEnabled) {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
         } else {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
         }
    +    if (isHA) {
    +      conf.unset(ConfigUtils.RM_HA_ID);
    +    }
         LOG.info("rm webapp address setting {}", address);
    --- End diff --
    
    the conf.set and conf.unset combo may not have the expected behavior if getRMWebAddress() is called by multiple threads at the same time.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by vrozov <gi...@git.apache.org>.
Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63448654
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    --- End diff --
    
    Should modification to `rmId` be done after the call to `conf.set(ConfigUtils.RM_HA_ID, rmId)`? It is not modified in `getRMHAAddress()`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by PramodSSImmaneni <gi...@git.apache.org>.
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63620740
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -731,20 +726,51 @@ public static ApplicationReport getStartedAppInstanceByName(YarnClient clientRMS
         return null;
       }
     
    +  /**
    +   * Return a YarnConfiguration instance from a Configuration instance
    +   * @param conf The configuration instance
    +   * @return The YarnConfiguration instance
    +   */
    +  public static YarnConfiguration getYarnConfiguration(Configuration conf)
    --- End diff --
    
    Yes will change it


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by PramodSSImmaneni <gi...@git.apache.org>.
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63578046
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    +    if (isHA) {
    +      conf = getYarnConfiguration(conf);
    +      conf.set(ConfigUtils.RM_HA_ID, rmId);
    +    }
         InetSocketAddress address;
         if (sslEnabled) {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
    --- End diff --
    
    You are right, thanks for catching this


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by PramodSSImmaneni <gi...@git.apache.org>.
Github user PramodSSImmaneni commented on the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#issuecomment-219811657
  
    Incorporated comments and squashed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by PramodSSImmaneni <gi...@git.apache.org>.
Github user PramodSSImmaneni commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63575308
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    +    if (isHA) {
    +      conf = getYarnConfiguration(conf);
    +      conf.set(ConfigUtils.RM_HA_ID, rmId);
    +    }
         InetSocketAddress address;
         if (sslEnabled) {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
         } else {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_PORT);
         }
    +    if (isHA) {
    +      conf.unset(ConfigUtils.RM_HA_ID);
    +    }
         LOG.info("rm webapp address setting {}", address);
    --- End diff --
    
    Current use is from a single thread but will make it thread safe.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by vrozov <gi...@git.apache.org>.
Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63450055
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -739,13 +745,21 @@ public static InetSocketAddress getRMWebAddress(Configuration conf, String rmId)
     
       public static InetSocketAddress getRMWebAddress(Configuration conf, boolean sslEnabled, String rmId)
       {
    -    rmId = (rmId == null) ? "" : ("." + rmId);
    +    boolean isHA = (rmId != null);
    +    rmId = isHA ? ("." + rmId) : "";
    +    if (isHA) {
    +      conf = getYarnConfiguration(conf);
    +      conf.set(ConfigUtils.RM_HA_ID, rmId);
    +    }
         InetSocketAddress address;
         if (sslEnabled) {
           address = conf.getSocketAddr(YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS + rmId, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_ADDRESS, YarnConfiguration.DEFAULT_RM_WEBAPP_HTTPS_PORT);
    --- End diff --
    
    rmId should not be appended to `YarnConfiguration.RM_WEBAPP_HTTPS_ADDRESS`. `YarnConfiguration.getSocketAddr()` will return value based on `RM_HA_ID`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-apex-core pull request: APEXCORE-458 Using the yarn conf...

Posted by vrozov <gi...@git.apache.org>.
Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-core/pull/334#discussion_r63597144
  
    --- Diff: engine/src/main/java/com/datatorrent/stram/client/StramClientUtils.java ---
    @@ -731,20 +726,51 @@ public static ApplicationReport getStartedAppInstanceByName(YarnClient clientRMS
         return null;
       }
     
    +  /**
    +   * Return a YarnConfiguration instance from a Configuration instance
    +   * @param conf The configuration instance
    +   * @return The YarnConfiguration instance
    +   */
    +  public static YarnConfiguration getYarnConfiguration(Configuration conf)
    --- End diff --
    
    can it be private?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---