[AURON #2137] Native thread name appends the original thread name (#2144)
# Which issue does this PR close?
Closes #2137
# Rationale for this change
# What changes are included in this PR?
# Are there any user-facing changes?
# How was this patch tested?
diff --git a/spark-extension/src/main/scala/org/apache/spark/sql/auron/util/TaskContextHelper.scala b/spark-extension/src/main/scala/org/apache/spark/sql/auron/util/TaskContextHelper.scala
index 8e5d735..309139e 100644
--- a/spark-extension/src/main/scala/org/apache/spark/sql/auron/util/TaskContextHelper.scala
+++ b/spark-extension/src/main/scala/org/apache/spark/sql/auron/util/TaskContextHelper.scala
@@ -45,12 +45,13 @@
def setNativeThreadName(): Unit = {
val context: TaskContext = TaskContext.get()
val thread = Thread.currentThread()
- val threadName = if (context != null) {
+ val threadPrefix = if (context != null) {
s"auron native task ${context.partitionId()}.${context.attemptNumber()} in stage ${context
.stageId()}.${context.stageAttemptNumber()} (TID ${context.taskAttemptId()})"
} else {
- "auron native task " + thread.getName
+ "auron native task"
}
+ val threadName = threadPrefix + " " + thread.getName
thread.setName(threadName)
}