hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From inigo...@apache.org
Subject [24/50] [abbrv] hadoop git commit: YARN-6520. Fix warnings from Spotbugs in hadoop-yarn-client. Contributed by Weiwei Yang.
Date Tue, 02 May 2017 21:54:20 GMT
YARN-6520. Fix warnings from Spotbugs in hadoop-yarn-client. Contributed by Weiwei Yang.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3c42e247
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3c42e247
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3c42e247

Branch: refs/heads/HDFS-10467
Commit: 3c42e247e7d5ac80b63bfa29315309e95f2a4c30
Parents: 2253b29
Author: Naganarasimha <naganarasimha_gr@apache.org>
Authored: Mon May 1 18:38:22 2017 +0530
Committer: Inigo <inigoiri@apache.org>
Committed: Tue May 2 14:52:05 2017 -0700

----------------------------------------------------------------------
 .../yarn/client/api/impl/YarnClientImpl.java    | 10 +++-
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 58 ++++++++------------
 2 files changed, 31 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c42e247/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java
index 8865b52..83210bd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/YarnClientImpl.java
@@ -367,9 +367,13 @@ public class YarnClientImpl extends YarnClient {
       if (timelineClient == null) {
         synchronized (this) {
           if (timelineClient == null) {
-            timelineClient = createTimelineClient();
-            timelineClient.init(getConfig());
-            timelineClient.start();
+            TimelineClient tlClient = createTimelineClient();
+            tlClient.init(getConfig());
+            tlClient.start();
+            // Assign value to timeline client variable only
+            // when it is fully initiated. In order to avoid
+            // other threads to see partially initialized object.
+            this.timelineClient = tlClient;
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3c42e247/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
index 4125a81..5528412 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
@@ -963,48 +963,38 @@ public class LogsCLI extends Configured implements Tool {
       request.setNodeId(nodeId);
       request.setContainerState(report.getContainerState());
     } catch (IOException | YarnException ex) {
-      if (isAppFinished) {
-        return printContainerLogsForFinishedApplicationWithoutNodeId(
-            request, logCliHelper, useRegex);
+      nodeHttpAddress = getNodeHttpAddressFromRMWebString(request);
+      if (nodeHttpAddress != null && !nodeHttpAddress.isEmpty()) {
+        request.setNodeHttpAddress(nodeHttpAddress);
       } else {
-        nodeHttpAddress = getNodeHttpAddressFromRMWebString(request);
-        if (nodeHttpAddress != null && !nodeHttpAddress.isEmpty()) {
-          request.setNodeHttpAddress(nodeHttpAddress);
+        // for the case, we have already uploaded partial logs in HDFS
+        int result = -1;
+        if (nodeAddress != null && !nodeAddress.isEmpty()) {
+          result = printAggregatedContainerLogs(request,
+              logCliHelper, useRegex);
         } else {
-          // for the case, we have already uploaded partial logs in HDFS
-          int result = -1;
-          if (nodeAddress != null && !nodeAddress.isEmpty()) {
-            result =  printAggregatedContainerLogs(
-                request, logCliHelper, useRegex);
-          } else {
-            result = printAggregatedContainerLogsWithoutNodeId(
-                request, logCliHelper, useRegex);
-          }
-          if (result == -1) {
-            System.err.println("Unable to get logs for this container:"
-                + containerIdStr + " for the application:" + appIdStr
-                + " with the appOwner: " + appOwner);
-            System.err.println("The application: " + appIdStr
-                + " is still running, and we can not get Container report "
-                + "for the container: " + containerIdStr +". Please try later "
-                + "or after the application finishes.");
-          }
-          return result;
+          result = printAggregatedContainerLogsWithoutNodeId(request,
+              logCliHelper,
+                  useRegex);
         }
+        if (result == -1) {
+          System.err.println(
+              "Unable to get logs for this container:"
+                  + containerIdStr + " for the application:"
+                  + appIdStr + " with the appOwner: " + appOwner);
+          System.err.println("The application: " + appIdStr
+              + " is still running, and we can not get Container report "
+              + "for the container: " + containerIdStr + ". Please try later "
+              + "or after the application finishes.");
+        }
+        return result;
       }
     }
     // If the application is not in the final state,
     // we will provide the NodeHttpAddress and get the container logs
     // by calling NodeManager webservice.
-    if (!isAppFinished) {
-      resultCode = printContainerLogsFromRunningApplication(getConf(), request,
-          logCliHelper, useRegex);
-    } else {
-      // If the application is in the final state, we will directly
-      // get the container logs from HDFS.
-      resultCode = printContainerLogsForFinishedApplication(
-          request, logCliHelper, useRegex);
-    }
+    resultCode = printContainerLogsFromRunningApplication(getConf(), request,
+        logCliHelper, useRegex);
     return resultCode;
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message