HeartSaVioR commented on a change in pull request #25943: [WIP][SPARK-29261][SQL][CORE] Support recover live entities from KVStore for (SQL)AppStatusListener URL: https://github.com/apache/spark/pull/25943#discussion_r332311914
########## File path: core/src/main/scala/org/apache/spark/status/storeTypes.scala ########## @@ -95,6 +151,65 @@ private[spark] class StageDataWrapper( @JsonIgnore @KVIndex("completionTime") private def completionTime: Long = info.completionTime.map(_.getTime).getOrElse(-1L) + + def toLiveStage(jobs: Seq[LiveJob]): LiveStage = { + val liveStage = new LiveStage + val firstLaunchTime = if (info.firstTaskLaunchedTime.isEmpty) { + Long.MaxValue + } else { + info.firstTaskLaunchedTime.get.getTime + } + val metrics = LiveEntityHelpers.createMetrics( + info.executorDeserializeTime, + info.executorDeserializeCpuTime, + info.executorRunTime, + info.executorCpuTime, + info.resultSize, + info.jvmGcTime, + info.resultSerializationTime, + info.memoryBytesSpilled, + info.diskBytesSpilled, + info.peakExecutionMemory, + info.inputBytes, + info.inputRecords, + info.outputBytes, + info.outputRecords, + info.shuffleRemoteBlocksFetched, + info.shuffleLocalBlocksFetched, + info.shuffleFetchWaitTime, + info.shuffleRemoteBytesRead, + info.shuffleRemoteBytesReadToDisk, + info.shuffleLocalBytesRead, + info.shuffleReadRecords, + info.shuffleWriteBytes, + info.shuffleWriteTime, + info.shuffleWriteRecords + ) + val stageInfo = new StageInfo( + info.stageId, + info.attemptId, + info.name, + info.numTasks, + Nil, // rddInfo + Nil, // parentIds + info.details) + liveStage.jobs = jobs + liveStage.jobIds = jobs.map(_.jobId).toSet + liveStage.info = stageInfo + liveStage.status = info.status + liveStage.description = info.description + liveStage.schedulingPool = info.schedulingPool + liveStage.activeTasks = info.numActiveTasks + liveStage.completedTasks = info.numCompleteTasks + liveStage.failedTasks = info.numFailedTasks + liveStage.completedIndicesNum = info.numCompletedIndices + liveStage.killedTasks = info.numKilledTasks + liveStage.killedSummary = info.killedTasksSummary + liveStage.firstLaunchTime = firstLaunchTime + liveStage.localitySummary = locality + liveStage.metrics = metrics Review comment: It might be better to leave a comment that `executorSummaries`, `activeTasksPerExecutor`, `blackListedExecutors`, and `savedTasks` are computed later from `recoverLiveEntities`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org