@@ -195,7 +195,9 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
195195
196196 val s1Tasks = createTasks(4 , execIds)
197197 s1Tasks.foreach { task =>
198- listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptId, task))
198+ listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId,
199+ stages.head.attemptNumber,
200+ task))
199201 }
200202
201203 assert(store.count(classOf [TaskDataWrapper ]) === s1Tasks.size)
@@ -213,10 +215,11 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
213215 check[TaskDataWrapper ](task.taskId) { wrapper =>
214216 assert(wrapper.info.taskId === task.taskId)
215217 assert(wrapper.stageId === stages.head.stageId)
216- assert(wrapper.stageAttemptId === stages.head.attemptId )
217- assert(Arrays .equals(wrapper.stage, Array (stages.head.stageId, stages.head.attemptId )))
218+ assert(wrapper.stageAttemptId === stages.head.attemptNumber )
219+ assert(Arrays .equals(wrapper.stage, Array (stages.head.stageId, stages.head.attemptNumber )))
218220
219- val runtime = Array [AnyRef ](stages.head.stageId: JInteger , stages.head.attemptId: JInteger ,
221+ val runtime = Array [AnyRef ](stages.head.stageId: JInteger ,
222+ stages.head.attemptNumber: JInteger ,
220223 - 1L : JLong )
221224 assert(Arrays .equals(wrapper.runtime, runtime))
222225
@@ -237,7 +240,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
237240 Some (1L ), None , true , false , None )
238241 listener.onExecutorMetricsUpdate(SparkListenerExecutorMetricsUpdate (
239242 task.executorId,
240- Seq ((task.taskId, stages.head.stageId, stages.head.attemptId , Seq (accum)))))
243+ Seq ((task.taskId, stages.head.stageId, stages.head.attemptNumber , Seq (accum)))))
241244 }
242245
243246 check[StageDataWrapper ](key(stages.head)) { stage =>
@@ -254,12 +257,12 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
254257 // Fail one of the tasks, re-start it.
255258 time += 1
256259 s1Tasks.head.markFinished(TaskState .FAILED , time)
257- listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptId ,
260+ listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptNumber ,
258261 " taskType" , TaskResultLost , s1Tasks.head, null ))
259262
260263 time += 1
261264 val reattempt = newAttempt(s1Tasks.head, nextTaskId())
262- listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptId ,
265+ listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptNumber ,
263266 reattempt))
264267
265268 assert(store.count(classOf [TaskDataWrapper ]) === s1Tasks.size + 1 )
@@ -289,7 +292,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
289292 val killed = s1Tasks.drop(1 ).head
290293 killed.finishTime = time
291294 killed.failed = true
292- listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptId ,
295+ listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptNumber ,
293296 " taskType" , TaskKilled (" killed" ), killed, null ))
294297
295298 check[JobDataWrapper ](1 ) { job =>
@@ -311,13 +314,13 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
311314 time += 1
312315 val denied = newAttempt(killed, nextTaskId())
313316 val denyReason = TaskCommitDenied (1 , 1 , 1 )
314- listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptId ,
317+ listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptNumber ,
315318 denied))
316319
317320 time += 1
318321 denied.finishTime = time
319322 denied.failed = true
320- listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptId ,
323+ listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptNumber ,
321324 " taskType" , denyReason, denied, null ))
322325
323326 check[JobDataWrapper ](1 ) { job =>
@@ -337,7 +340,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
337340
338341 // Start a new attempt.
339342 val reattempt2 = newAttempt(denied, nextTaskId())
340- listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptId ,
343+ listener.onTaskStart(SparkListenerTaskStart (stages.head.stageId, stages.head.attemptNumber ,
341344 reattempt2))
342345
343346 // Succeed all tasks in stage 1.
@@ -350,7 +353,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
350353 time += 1
351354 pending.foreach { task =>
352355 task.markFinished(TaskState .FINISHED , time)
353- listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptId ,
356+ listener.onTaskEnd(SparkListenerTaskEnd (stages.head.stageId, stages.head.attemptNumber ,
354357 " taskType" , Success , task, s1Metrics))
355358 }
356359
@@ -414,13 +417,15 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
414417 time += 1
415418 val s2Tasks = createTasks(4 , execIds)
416419 s2Tasks.foreach { task =>
417- listener.onTaskStart(SparkListenerTaskStart (stages.last.stageId, stages.last.attemptId, task))
420+ listener.onTaskStart(SparkListenerTaskStart (stages.last.stageId,
421+ stages.last.attemptNumber,
422+ task))
418423 }
419424
420425 time += 1
421426 s2Tasks.foreach { task =>
422427 task.markFinished(TaskState .FAILED , time)
423- listener.onTaskEnd(SparkListenerTaskEnd (stages.last.stageId, stages.last.attemptId ,
428+ listener.onTaskEnd(SparkListenerTaskEnd (stages.last.stageId, stages.last.attemptNumber ,
424429 " taskType" , TaskResultLost , task, null ))
425430 }
426431
@@ -455,7 +460,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
455460
456461 // - Re-submit stage 2, all tasks, and succeed them and the stage.
457462 val oldS2 = stages.last
458- val newS2 = new StageInfo (oldS2.stageId, oldS2.attemptId + 1 , oldS2.name, oldS2.numTasks,
463+ val newS2 = new StageInfo (oldS2.stageId, oldS2.attemptNumber + 1 , oldS2.name, oldS2.numTasks,
459464 oldS2.rddInfos, oldS2.parentIds, oldS2.details, oldS2.taskMetrics)
460465
461466 time += 1
@@ -466,14 +471,14 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
466471 val newS2Tasks = createTasks(4 , execIds)
467472
468473 newS2Tasks.foreach { task =>
469- listener.onTaskStart(SparkListenerTaskStart (newS2.stageId, newS2.attemptId , task))
474+ listener.onTaskStart(SparkListenerTaskStart (newS2.stageId, newS2.attemptNumber , task))
470475 }
471476
472477 time += 1
473478 newS2Tasks.foreach { task =>
474479 task.markFinished(TaskState .FINISHED , time)
475- listener.onTaskEnd(SparkListenerTaskEnd (newS2.stageId, newS2.attemptId , " taskType" , Success ,
476- task, null ))
480+ listener.onTaskEnd(SparkListenerTaskEnd (newS2.stageId, newS2.attemptNumber , " taskType" ,
481+ Success , task, null ))
477482 }
478483
479484 time += 1
@@ -522,14 +527,15 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
522527 val j2s2Tasks = createTasks(4 , execIds)
523528
524529 j2s2Tasks.foreach { task =>
525- listener.onTaskStart(SparkListenerTaskStart (j2Stages.last.stageId, j2Stages.last.attemptId,
530+ listener.onTaskStart(SparkListenerTaskStart (j2Stages.last.stageId,
531+ j2Stages.last.attemptNumber,
526532 task))
527533 }
528534
529535 time += 1
530536 j2s2Tasks.foreach { task =>
531537 task.markFinished(TaskState .FINISHED , time)
532- listener.onTaskEnd(SparkListenerTaskEnd (j2Stages.last.stageId, j2Stages.last.attemptId ,
538+ listener.onTaskEnd(SparkListenerTaskEnd (j2Stages.last.stageId, j2Stages.last.attemptNumber ,
533539 " taskType" , Success , task, null ))
534540 }
535541
@@ -919,13 +925,13 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
919925 time += 1
920926 val tasks = createTasks(2 , Array (" 1" ))
921927 tasks.foreach { task =>
922- listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptId , task))
928+ listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptNumber , task))
923929 }
924930 assert(store.count(classOf [TaskDataWrapper ]) === 2 )
925931
926932 // Start a 3rd task. The finished tasks should be deleted.
927933 createTasks(1 , Array (" 1" )).foreach { task =>
928- listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptId , task))
934+ listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptNumber , task))
929935 }
930936 assert(store.count(classOf [TaskDataWrapper ]) === 2 )
931937 intercept[NoSuchElementException ] {
@@ -934,7 +940,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
934940
935941 // Start a 4th task. The first task should be deleted, even if it's still running.
936942 createTasks(1 , Array (" 1" )).foreach { task =>
937- listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptId , task))
943+ listener.onTaskStart(SparkListenerTaskStart (attempt2.stageId, attempt2.attemptNumber , task))
938944 }
939945 assert(store.count(classOf [TaskDataWrapper ]) === 2 )
940946 intercept[NoSuchElementException ] {
@@ -960,7 +966,7 @@ class AppStatusListenerSuite extends SparkFunSuite with BeforeAndAfter {
960966 }
961967 }
962968
963- private def key (stage : StageInfo ): Array [Int ] = Array (stage.stageId, stage.attemptId )
969+ private def key (stage : StageInfo ): Array [Int ] = Array (stage.stageId, stage.attemptNumber )
964970
965971 private def check [T : ClassTag ](key : Any )(fn : T => Unit ): Unit = {
966972 val value = store.read(classTag[T ].runtimeClass, key).asInstanceOf [T ]
0 commit comments