Skip to content
Snippets Groups Projects
Commit 0d28bdce authored by Matei Zaharia's avatar Matei Zaharia
Browse files

A couple of minor fixes:

- Don't include trailing $'s in class names of Scala objects
- Report errors using logError instead of printStackTrace
parent 0fa70a67
No related branches found
No related tags found
No related merge requests found
......@@ -13,10 +13,15 @@ trait Logging {
// be serialized and used on another machine
@transient private var log_ : Logger = null
// Method to get or create the logger
// Method to get or create the logger for this object
def log: Logger = {
if (log_ == null)
log_ = LoggerFactory.getLogger(this.getClass())
if (log_ == null) {
var className = this.getClass().getName()
// Ignore trailing $'s in the class names for Scala objects
if (className.endsWith("$"))
className = className.substring(0, className.length - 1)
log_ = LoggerFactory.getLogger(className)
}
return log_
}
......
......@@ -137,7 +137,7 @@ extends NScheduler with spark.Scheduler with Logging
case None => {}
}
} catch {
case e: Exception => e.printStackTrace
case e: Exception => logError("Exception in resourceOffer", e)
}
}
}
......@@ -161,7 +161,7 @@ extends NScheduler with spark.Scheduler with Logging
}
} catch {
case e: Exception => e.printStackTrace
case e: Exception => logError("Exception in statusUpdate", e)
}
}
}
......@@ -173,7 +173,7 @@ extends NScheduler with spark.Scheduler with Logging
try {
activeOp.error(code, message)
} catch {
case e: Exception => e.printStackTrace
case e: Exception => logError("Exception in error callback", e)
}
}
} else {
......@@ -260,9 +260,11 @@ extends ParallelOperation with Logging
val taskId = sched.newTaskId()
sched.taskIdToOpId(taskId) = opId
tidToIndex(taskId) = i
printf("Starting task %d as opId %d, TID %s on slave %s: %s (%s)",
i, opId, taskId, offer.getSlaveId, offer.getHost,
if(checkPref) "preferred" else "non-preferred")
val preferred = if(checkPref) "preferred" else "non-preferred"
val message =
"Starting task %d as opId %d, TID %s on slave %s: %s (%s)".format(
i, opId, taskId, offer.getSlaveId, offer.getHost, preferred)
logInfo(message)
tasks(i).markStarted(offer)
launched(i) = true
tasksLaunched += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment