Browse Source

YARN-7261. Add debug message for better download latency monitoring. (Yufei Gu)

(cherry picked from commit 0799fde35e7f3b9e8a85284ac0b30f6bdcbffad1)
Yufei Gu 7 years ago
parent
commit
c3946f29e7

+ 15 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/FSDownload.java

@@ -350,6 +350,11 @@ public class FSDownload implements Callable<Path> {
     } catch (URISyntaxException e) {
       throw new IOException("Invalid resource", e);
     }
+
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Starting to download " + sCopy);
+    }
+
     createDir(destDirPath, cachePerms);
     final Path dst_work = new Path(destDirPath + "_tmp");
     createDir(dst_work, cachePerms);
@@ -364,6 +369,11 @@ public class FSDownload implements Callable<Path> {
       unpack(new File(dTmp.toUri()), new File(dFinal.toUri()));
       changePermissions(dFinal.getFileSystem(conf), dFinal);
       files.rename(dst_work, destDirPath, Rename.OVERWRITE);
+
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("File has been downloaded to " +
+            new Path(destDirPath, sCopy.getName()));
+      }
     } catch (Exception e) {
       try {
         files.delete(destDirPath, true);
@@ -409,8 +419,11 @@ public class FSDownload implements Callable<Path> {
       // APPLICATION:
       perm = isDir ? PRIVATE_DIR_PERMS : PRIVATE_FILE_PERMS;
     }
-    LOG.debug("Changing permissions for path " + path
-        + " to perm " + perm);
+
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Changing permissions for path " + path + " to perm " + perm);
+    }
+
     final FsPermission fPerm = perm;
     if (null == userUgi) {
       files.setPermission(path, perm);

+ 10 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java

@@ -859,7 +859,7 @@ public class ResourceLocalizationService extends CompositeService
       // TODO handle failures, cancellation, requests by other containers
       LocalizedResource rsrc = request.getResource();
       LocalResourceRequest key = rsrc.getRequest();
-      LOG.info("Downloading public rsrc:" + key);
+      LOG.info("Downloading public resource: " + key);
       /*
        * Here multiple containers may request the same resource. So we need
        * to start downloading only when
@@ -918,8 +918,17 @@ public class ResourceLocalizationService extends CompositeService
                 + " Either queue is full or threadpool is shutdown.", re);
           }
         } else {
+          if (LOG.isDebugEnabled()) {
+            LOG.debug("Skip downloading resource: " + key + " since it's in"
+                + " state: " + rsrc.getState());
+          }
           rsrc.unlock();
         }
+      } else {
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Skip downloading resource: " + key + " since it is locked"
+              + " by other threads");
+        }
       }
     }