Skip to content

Commit 9becde3

Browse files
committed
Move registration of task with BlockManager into Task.run()
1 parent b963178 commit 9becde3

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

core/src/main/scala/org/apache/spark/executor/Executor.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ private[spark] class Executor(
207207
logDebug("Task " + taskId + "'s epoch is " + task.epoch)
208208
env.mapOutputTracker.updateEpoch(task.epoch)
209209

210-
env.blockManager.registerTask(taskId)
211-
212210
// Run the actual task and measure its runtime.
213211
taskStart = System.currentTimeMillis()
214212
var threwException = true

core/src/main/scala/org/apache/spark/scheduler/Task.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ private[spark] abstract class Task[T](
6464
taskAttemptId: Long,
6565
attemptNumber: Int,
6666
metricsSystem: MetricsSystem): T = {
67+
SparkEnv.get.blockManager.registerTask(taskAttemptId)
6768
context = new TaskContextImpl(
6869
stageId,
6970
partitionId,

core/src/test/scala/org/apache/spark/CacheManagerSuite.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class CacheManagerSuite extends SparkFunSuite with LocalSparkContext with Before
8787
val context = TaskContext.empty()
8888
try {
8989
TaskContext.setTaskContext(context)
90+
sc.env.blockManager.registerTask(0)
9091
cacheManager.getOrCompute(rdd3, split, context, StorageLevel.MEMORY_ONLY)
9192
assert(context.taskMetrics.updatedBlockStatuses.size === 2)
9293
} finally {

0 commit comments

Comments
 (0)