EBernhardson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395611 )

Change subject: Add unique tag to log instances in RabitTracker
......................................................................

Add unique tag to log instances in RabitTracker

We often have between 15 and 100 separate RabitTracker instances running
at the same time and it's incredibly difficult to figure out when one
errors out what other logs are related to the one that failed. This
doesn't completely solve the problem of associating non-tracker logs
(like executor kills by yarn), but it at least helps distinguish
the output from the separate trackers.

Change-Id: Ic4189ae318316be405b3be499d95b2849b0e6f61
---
M jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java
1 file changed, 9 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/search/xgboost 
refs/changes/11/395611/1

diff --git 
a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java 
b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java
index 888d501..4927466 100644
--- 
a/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java
+++ 
b/jvm-packages/xgboost4j/src/main/java/ml/dmlc/xgboost4j/java/RabitTracker.java
@@ -5,7 +5,7 @@
 import java.io.*;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.concurrent.TimeUnit;
+import java.util.Random;
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.commons.logging.Log;
@@ -23,8 +23,10 @@
  * The tracker must be started on driver node before running distributed jobs.
  */
 public class RabitTracker implements IRabitTracker {
-  // Maybe per tracker logger?
-  private static final Log logger = LogFactory.getLog(RabitTracker.class);
+  private static final Log classLogger = LogFactory.getLog(RabitTracker.class);
+  private static final Random random = new Random();
+  private final String logTag = Integer.toHexString(random.nextInt());
+  private final Log logger = LogFactory.getLog(RabitTracker.class.getName() + 
'@' + logTag);
   // tracker python file.
   private static String tracker_py = null;
   // environment variable to be pased.
@@ -37,8 +39,8 @@
     try {
       initTrackerPy();
     } catch (IOException ex) {
-      logger.error("load tracker library failed.");
-      logger.error(ex);
+      classLogger.error("load tracker library failed.");
+      classLogger.error(ex);
     }
   }
 
@@ -48,7 +50,7 @@
   private class TrackerProcessLogger implements Runnable {
     public void run() {
 
-      Log trackerProcessLogger = LogFactory.getLog(TrackerProcessLogger.class);
+      Log trackerProcessLogger = 
LogFactory.getLog(TrackerProcessLogger.class.getName() + '@' + logTag);
       BufferedReader reader = new BufferedReader(new InputStreamReader(
               trackerProcess.get().getErrorStream()));
       String line;
@@ -73,7 +75,7 @@
     try {
       tracker_py = NativeLibLoader.createTempFileFromResource("/tracker.py");
     } catch (IOException ioe) {
-      logger.trace("cannot access tracker python script");
+      classLogger.trace("cannot access tracker python script");
       throw ioe;
     }
   }

-- 
To view, visit https://gerrit.wikimedia.org/r/395611
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4189ae318316be405b3be499d95b2849b0e6f61
Gerrit-PatchSet: 1
Gerrit-Project: search/xgboost
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to