[ 
https://issues.apache.org/jira/browse/YARN-5227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15352066#comment-15352066
 ] 

Xuan Gong commented on YARN-5227:
---------------------------------

[~GergelyNovak]
Thanks for working on this. The logic looks good to me. But let us re-factory a 
little bit. We could do something like:
{code}
    ApplicationId appId = null;
    ContainerId containerId = null;
    if (appIdStr != null) {
      try {
        appId = ApplicationId.fromString(appIdStr);
      } catch (Exception e) {
        System.err.println("Invalid ApplicationId specified");
        return -1;
      }
    } 

    if (containerIdStr != null) {
      try {
        containerId = ContainerId.fromString(containerIdStr);
        if (appId == null) {
          appId = containerId.getApplicationAttemptId().getApplicationId();
        } else if(!containerId.getApplicationAttemptId().getApplicationId()
            .equals(appId)) {
          System.err.println("The Application:" + appId
              + " does not have the container:" + containerId);
          return -1;
        }
      } catch (Exception e) {
          System.err.println("Invalid ContainerId specified");
          return -1;      
      }
    }
{code}

> yarn logs command: no need to specify -applicationId when specifying 
> containerId
> --------------------------------------------------------------------------------
>
>                 Key: YARN-5227
>                 URL: https://issues.apache.org/jira/browse/YARN-5227
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Jian He
>            Assignee: Gergely Novák
>         Attachments: YARN-5227.001.patch
>
>
> No need to specify -applicaionId when specifying containerId, because 
> applicationId is retrievable from containerId



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to