Skip to content

Commit c991b1b

Browse files
committed
Moving some code into the Accumulators class
1 parent 9a9ba3c commit c991b1b

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

core/src/main/scala/org/apache/spark/Accumulators.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,4 +289,7 @@ private object Accumulators {
289289
}
290290
}
291291
}
292+
293+
def stringifyPartialValue(partialValue: Any) = "%s".format(value)
294+
def stringifyValue(value: Any) = "%s".format(value)
292295
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,6 @@ class DAGScheduler(
907907
listenerBus.post(SparkListenerStageCompleted(stage.info))
908908
runningStages -= stage
909909
}
910-
911910
event.reason match {
912911
case Success =>
913912
if (event.accumUpdates != null) {
@@ -918,8 +917,8 @@ class DAGScheduler(
918917
// To avoid UI cruft, ignore cases where value wasn't updated
919918
if (acc.name.isDefined && partialValue != acc.zero) {
920919
val name = acc.name.get
921-
val stringPartialValue = "%s".format(partialValue)
922-
val stringValue = "%s".format(acc.value)
920+
val stringPartialValue = Accumulators.stringifyPartialValue(partialValue)
921+
val stringValue = Accumulators.stringifyValue(acc.value)
923922
stage.info.accumulables(id) = AccumulableInfo(id, name, stringValue)
924923
event.taskInfo.accumulables +=
925924
AccumulableInfo(id, name, Some(stringPartialValue), stringValue)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class TaskInfo(
4646
/**
4747
* Intermediate updates to accumulables during this task. Note that it is valid for the same
4848
* accumulable to be updated multiple times in a single task or for two accumulables with the
49-
* same name but different ID's to exist in a task.
49+
* same name but different IDs to exist in a task.
5050
*/
5151
val accumulables = ListBuffer[AccumulableInfo]()
5252

0 commit comments

Comments
 (0)