Skip to content

Commit

Permalink
fix style and add non-zero cpu times in JsonProtocolSuite testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jisookim0513 committed Sep 23, 2016
1 parent d9c5f8f commit f0ef503
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions core/src/main/scala/org/apache/spark/util/JsonProtocol.scala
Expand Up @@ -763,13 +763,13 @@ private[spark] object JsonProtocol {
metrics.setExecutorDeserializeTime((json \ "Executor Deserialize Time").extract[Long])
metrics.setExecutorDeserializeCpuTime((json \ "Executor Deserialize CPU Time") match {
case JNothing => 0
case x => x.extract[Long]}
)
case x => x.extract[Long]
})
metrics.setExecutorRunTime((json \ "Executor Run Time").extract[Long])
metrics.setExecutorCpuTime((json \ "Executor CPU Time") match {
case JNothing => 0
case x => x.extract[Long]}
)
case x => x.extract[Long]
})
metrics.setResultSize((json \ "Result Size").extract[Long])
metrics.setJvmGCTime((json \ "JVM GC Time").extract[Long])
metrics.setResultSerializationTime((json \ "Result Serialization Time").extract[Long])
Expand Down
19 changes: 11 additions & 8 deletions core/src/test/scala/org/apache/spark/util/JsonProtocolSuite.scala
Expand Up @@ -819,8 +819,11 @@ private[spark] object JsonProtocolSuite extends Assertions {
hasOutput: Boolean,
hasRecords: Boolean = true) = {
val t = TaskMetrics.empty
// Set CPU times same as wall times for testing purpose
t.setExecutorDeserializeTime(a)
t.setExecutorDeserializeCpuTime(a)
t.setExecutorRunTime(b)
t.setExecutorCpuTime(b)
t.setResultSize(c)
t.setJvmGCTime(d)
t.setResultSerializationTime(a + b)
Expand Down Expand Up @@ -1100,9 +1103,9 @@ private[spark] object JsonProtocolSuite extends Assertions {
| },
| "Task Metrics": {
| "Executor Deserialize Time": 300,
| "Executor Deserialize CPU Time": 0,
| "Executor Deserialize CPU Time": 300,
| "Executor Run Time": 400,
| "Executor CPU Time": 0,
| "Executor CPU Time": 400,
| "Result Size": 500,
| "JVM GC Time": 600,
| "Result Serialization Time": 700,
Expand Down Expand Up @@ -1200,9 +1203,9 @@ private[spark] object JsonProtocolSuite extends Assertions {
| },
| "Task Metrics": {
| "Executor Deserialize Time": 300,
| "Executor Deserialize CPU Time": 0,
| "Executor Deserialize CPU Time": 300,
| "Executor Run Time": 400,
| "Executor CPU Time": 0,
| "Executor CPU Time": 400,
| "Result Size": 500,
| "JVM GC Time": 600,
| "Result Serialization Time": 700,
Expand Down Expand Up @@ -1300,9 +1303,9 @@ private[spark] object JsonProtocolSuite extends Assertions {
| },
| "Task Metrics": {
| "Executor Deserialize Time": 300,
| "Executor Deserialize CPU Time": 0,
| "Executor Deserialize CPU Time": 300,
| "Executor Run Time": 400,
| "Executor CPU Time": 0,
| "Executor CPU Time": 400,
| "Result Size": 500,
| "JVM GC Time": 600,
| "Result Serialization Time": 700,
Expand Down Expand Up @@ -1795,7 +1798,7 @@ private[spark] object JsonProtocolSuite extends Assertions {
| {
| "ID": 1,
| "Name": "$EXECUTOR_DESERIALIZE_CPU_TIME",
| "Update": 0,
| "Update": 300,
| "Internal": true,
| "Count Failed Values": true
| },
Expand All @@ -1810,7 +1813,7 @@ private[spark] object JsonProtocolSuite extends Assertions {
| {
| "ID": 3,
| "Name": "$EXECUTOR_CPU_TIME",
| "Update": 0,
| "Update": 400,
| "Internal": true,
| "Count Failed Values": true
| },
Expand Down

0 comments on commit f0ef503

Please sign in to comment.