Package org.apache.spark.util
Class JsonProtocol
Object
org.apache.spark.util.JsonProtocol
Serializes SparkListener events to/from JSON. This protocol provides strong backwards-
and forwards-compatibility guarantees: any version of Spark should be able to read JSON output
written by any other version, including newer versions.
JsonProtocolSuite contains backwards-compatibility tests which check that the current version of JsonProtocol is able to read output written by earlier versions. We do not currently have tests for reading newer JSON output with older Spark versions.
To ensure that we provide these guarantees, follow these rules when modifying these methods:
- Never delete any JSON fields.
- Any new JSON fields should be optional; use jsonOption
when reading these fields
in *FromJson
methods.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic AccumulableInfo
accumulableInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
accumulableInfoToJson
(AccumulableInfo accumulableInfo, com.fasterxml.jackson.core.JsonGenerator g) static void
accumulablesToJson
(scala.collection.Iterable<AccumulableInfo> accumulables, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerApplicationEnd
applicationEndFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
applicationEndToJson
(SparkListenerApplicationEnd applicationEnd, com.fasterxml.jackson.core.JsonGenerator g) applicationStartFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
applicationStartToJson
(SparkListenerApplicationStart applicationStart, com.fasterxml.jackson.core.JsonGenerator g) blockManagerAddedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockManagerAddedToJson
(SparkListenerBlockManagerAdded blockManagerAdded, com.fasterxml.jackson.core.JsonGenerator g) static BlockManagerId
blockManagerIdFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockManagerIdToJson
(BlockManagerId blockManagerId, com.fasterxml.jackson.core.JsonGenerator g) blockManagerRemovedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockManagerRemovedToJson
(SparkListenerBlockManagerRemoved blockManagerRemoved, com.fasterxml.jackson.core.JsonGenerator g) static BlockStatus
blockStatusFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockStatusToJson
(BlockStatus blockStatus, com.fasterxml.jackson.core.JsonGenerator g) static BlockUpdatedInfo
blockUpdatedInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockUpdatedInfoToJson
(BlockUpdatedInfo blockUpdatedInfo, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerBlockUpdated
blockUpdateFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
blockUpdateToJson
(SparkListenerBlockUpdated blockUpdate, com.fasterxml.jackson.core.JsonGenerator g) environmentUpdateFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
environmentUpdateToJson
(SparkListenerEnvironmentUpdate environmentUpdate, com.fasterxml.jackson.core.JsonGenerator g) static Exception
exceptionFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
exceptionToJson
(Exception exception, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerExecutorAdded
executorAddedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
executorAddedToJson
(SparkListenerExecutorAdded executorAdded, com.fasterxml.jackson.core.JsonGenerator g) static ExecutorInfo
executorInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
executorInfoToJson
(ExecutorInfo executorInfo, com.fasterxml.jackson.core.JsonGenerator g) static org.apache.spark.executor.ExecutorMetrics
executorMetricsFromJson
(com.fasterxml.jackson.databind.JsonNode maybeJson) Extract the executor metrics from JSON.static void
executorMetricsToJson
(org.apache.spark.executor.ExecutorMetrics executorMetrics, com.fasterxml.jackson.core.JsonGenerator g) Convert executor metrics to JSON.executorMetricsUpdateFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
executorMetricsUpdateToJson
(SparkListenerExecutorMetricsUpdate metricsUpdate, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerExecutorRemoved
executorRemovedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
executorRemovedToJson
(SparkListenerExecutorRemoved executorRemoved, com.fasterxml.jackson.core.JsonGenerator g) static ExecutorResourceRequest
executorResourceRequestFromJson
(com.fasterxml.jackson.databind.JsonNode json) static scala.collection.Map<String,
ExecutorResourceRequest> executorResourceRequestMapFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
executorResourceRequestMapToJson
(scala.collection.Map<String, ExecutorResourceRequest> m, com.fasterxml.jackson.core.JsonGenerator g) static void
executorResourceRequestToJson
(ExecutorResourceRequest execReq, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerJobEnd
jobEndFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
jobEndToJson
(SparkListenerJobEnd jobEnd, com.fasterxml.jackson.core.JsonGenerator g) static JobResult
jobResultFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
jobResultToJson
(JobResult jobResult, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerJobStart
jobStartFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
jobStartToJson
(SparkListenerJobStart jobStart, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerLogStart
logStartFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
logStartToJson
(SparkListenerLogStart logStart, com.fasterxml.jackson.core.JsonGenerator g) mapFromJson
(com.fasterxml.jackson.databind.JsonNode json) -------------------------------- * Util JSON deserialization methods |static Properties
propertiesFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
propertiesToJson
(Properties properties, com.fasterxml.jackson.core.JsonGenerator g) static RDDInfo
rddInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
rddInfoToJson
(RDDInfo rddInfo, com.fasterxml.jackson.core.JsonGenerator g) resourceProfileAddedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
resourceProfileAddedToJson
(SparkListenerResourceProfileAdded profileAdded, com.fasterxml.jackson.core.JsonGenerator g) static scala.collection.Map<String,
ResourceInformation> resourcesMapFromJson
(com.fasterxml.jackson.databind.JsonNode json) static SparkListenerEvent
sparkEventFromJson
(com.fasterxml.jackson.databind.JsonNode json) static SparkListenerEvent
sparkEventFromJson
(String json) static String
------------------------------------------------- * JSON serialization methods for SparkListenerEvents |static StackTraceElement[]
stackTraceFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
stackTraceToJson
(StackTraceElement[] stackTrace, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerStageCompleted
stageCompletedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
stageCompletedToJson
(SparkListenerStageCompleted stageCompleted, com.fasterxml.jackson.core.JsonGenerator g) stageExecutorMetricsFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
stageExecutorMetricsToJson
(SparkListenerStageExecutorMetrics metrics, com.fasterxml.jackson.core.JsonGenerator g) static StageInfo
stageInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) --------------------------------------------------------------------- * JSON deserialization methods for classes SparkListenerEvents depend on |static void
stageInfoToJson
(StageInfo stageInfo, com.fasterxml.jackson.core.JsonGenerator g, boolean includeAccumulables) ------------------------------------------------------------------- * JSON serialization methods for classes SparkListenerEvents depend on |static SparkListenerStageSubmitted
stageSubmittedFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
stageSubmittedToJson
(SparkListenerStageSubmitted stageSubmitted, com.fasterxml.jackson.core.JsonGenerator g) static StorageLevel
storageLevelFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
storageLevelToJson
(StorageLevel storageLevel, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerTaskEnd
taskEndFromJson
(com.fasterxml.jackson.databind.JsonNode json) static TaskEndReason
taskEndReasonFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskEndReasonToJson
(TaskEndReason taskEndReason, com.fasterxml.jackson.core.JsonGenerator g) static void
taskEndToJson
(SparkListenerTaskEnd taskEnd, com.fasterxml.jackson.core.JsonGenerator g) taskGettingResultFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskGettingResultToJson
(SparkListenerTaskGettingResult taskGettingResult, com.fasterxml.jackson.core.JsonGenerator g) static TaskInfo
taskInfoFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskInfoToJson
(TaskInfo taskInfo, com.fasterxml.jackson.core.JsonGenerator g, boolean includeAccumulables) static org.apache.spark.executor.TaskMetrics
taskMetricsFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskMetricsToJson
(org.apache.spark.executor.TaskMetrics taskMetrics, com.fasterxml.jackson.core.JsonGenerator g) static TaskResourceRequest
taskResourceRequestFromJson
(com.fasterxml.jackson.databind.JsonNode json) static scala.collection.Map<String,
TaskResourceRequest> taskResourceRequestMapFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskResourceRequestMapToJson
(scala.collection.Map<String, TaskResourceRequest> m, com.fasterxml.jackson.core.JsonGenerator g) static void
taskResourceRequestToJson
(TaskResourceRequest taskReq, com.fasterxml.jackson.core.JsonGenerator g) static SparkListenerTaskStart
taskStartFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
taskStartToJson
(SparkListenerTaskStart taskStart, com.fasterxml.jackson.core.JsonGenerator g) static String
toJsonString
(scala.Function1<com.fasterxml.jackson.core.JsonGenerator, scala.runtime.BoxedUnit> block) static SparkListenerUnpersistRDD
unpersistRDDFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
unpersistRDDToJson
(SparkListenerUnpersistRDD unpersistRDD, com.fasterxml.jackson.core.JsonGenerator g) static UUID
UUIDFromJson
(com.fasterxml.jackson.databind.JsonNode json) static void
UUIDToJson
(UUID id, com.fasterxml.jackson.core.JsonGenerator g) static void
writeMapField
(String name, scala.collection.Map<String, String> m, com.fasterxml.jackson.core.JsonGenerator g) ------------------------------ * Util JSON serialization methods |static void
writeSparkEventToJson
(SparkListenerEvent event, com.fasterxml.jackson.core.JsonGenerator g)
-
Constructor Details
-
JsonProtocol
public JsonProtocol()
-
-
Method Details
-
sparkEventToJsonString
------------------------------------------------- * JSON serialization methods for SparkListenerEvents |- Parameters:
event
- (undocumented)- Returns:
- (undocumented) --------------------------------------------------
-
writeSparkEventToJson
public static void writeSparkEventToJson(SparkListenerEvent event, com.fasterxml.jackson.core.JsonGenerator g) -
stageSubmittedToJson
public static void stageSubmittedToJson(SparkListenerStageSubmitted stageSubmitted, com.fasterxml.jackson.core.JsonGenerator g) -
stageCompletedToJson
public static void stageCompletedToJson(SparkListenerStageCompleted stageCompleted, com.fasterxml.jackson.core.JsonGenerator g) -
taskStartToJson
public static void taskStartToJson(SparkListenerTaskStart taskStart, com.fasterxml.jackson.core.JsonGenerator g) -
taskGettingResultToJson
public static void taskGettingResultToJson(SparkListenerTaskGettingResult taskGettingResult, com.fasterxml.jackson.core.JsonGenerator g) -
taskEndToJson
public static void taskEndToJson(SparkListenerTaskEnd taskEnd, com.fasterxml.jackson.core.JsonGenerator g) -
jobStartToJson
public static void jobStartToJson(SparkListenerJobStart jobStart, com.fasterxml.jackson.core.JsonGenerator g) -
jobEndToJson
public static void jobEndToJson(SparkListenerJobEnd jobEnd, com.fasterxml.jackson.core.JsonGenerator g) -
environmentUpdateToJson
public static void environmentUpdateToJson(SparkListenerEnvironmentUpdate environmentUpdate, com.fasterxml.jackson.core.JsonGenerator g) -
blockManagerAddedToJson
public static void blockManagerAddedToJson(SparkListenerBlockManagerAdded blockManagerAdded, com.fasterxml.jackson.core.JsonGenerator g) -
blockManagerRemovedToJson
public static void blockManagerRemovedToJson(SparkListenerBlockManagerRemoved blockManagerRemoved, com.fasterxml.jackson.core.JsonGenerator g) -
unpersistRDDToJson
public static void unpersistRDDToJson(SparkListenerUnpersistRDD unpersistRDD, com.fasterxml.jackson.core.JsonGenerator g) -
applicationStartToJson
public static void applicationStartToJson(SparkListenerApplicationStart applicationStart, com.fasterxml.jackson.core.JsonGenerator g) -
applicationEndToJson
public static void applicationEndToJson(SparkListenerApplicationEnd applicationEnd, com.fasterxml.jackson.core.JsonGenerator g) -
resourceProfileAddedToJson
public static void resourceProfileAddedToJson(SparkListenerResourceProfileAdded profileAdded, com.fasterxml.jackson.core.JsonGenerator g) -
executorAddedToJson
public static void executorAddedToJson(SparkListenerExecutorAdded executorAdded, com.fasterxml.jackson.core.JsonGenerator g) -
executorRemovedToJson
public static void executorRemovedToJson(SparkListenerExecutorRemoved executorRemoved, com.fasterxml.jackson.core.JsonGenerator g) -
logStartToJson
public static void logStartToJson(SparkListenerLogStart logStart, com.fasterxml.jackson.core.JsonGenerator g) -
executorMetricsUpdateToJson
public static void executorMetricsUpdateToJson(SparkListenerExecutorMetricsUpdate metricsUpdate, com.fasterxml.jackson.core.JsonGenerator g) -
stageExecutorMetricsToJson
public static void stageExecutorMetricsToJson(SparkListenerStageExecutorMetrics metrics, com.fasterxml.jackson.core.JsonGenerator g) -
blockUpdateToJson
public static void blockUpdateToJson(SparkListenerBlockUpdated blockUpdate, com.fasterxml.jackson.core.JsonGenerator g) -
stageInfoToJson
public static void stageInfoToJson(StageInfo stageInfo, com.fasterxml.jackson.core.JsonGenerator g, boolean includeAccumulables) ------------------------------------------------------------------- * JSON serialization methods for classes SparkListenerEvents depend on |- Parameters:
stageInfo
- (undocumented)g
- (undocumented)includeAccumulables
- (undocumented) --------------------------------------------------------------------
-
taskInfoToJson
public static void taskInfoToJson(TaskInfo taskInfo, com.fasterxml.jackson.core.JsonGenerator g, boolean includeAccumulables) -
accumulablesToJson
public static void accumulablesToJson(scala.collection.Iterable<AccumulableInfo> accumulables, com.fasterxml.jackson.core.JsonGenerator g) -
accumulableInfoToJson
public static void accumulableInfoToJson(AccumulableInfo accumulableInfo, com.fasterxml.jackson.core.JsonGenerator g) -
taskMetricsToJson
public static void taskMetricsToJson(org.apache.spark.executor.TaskMetrics taskMetrics, com.fasterxml.jackson.core.JsonGenerator g) -
executorMetricsToJson
public static void executorMetricsToJson(org.apache.spark.executor.ExecutorMetrics executorMetrics, com.fasterxml.jackson.core.JsonGenerator g) Convert executor metrics to JSON. -
taskEndReasonToJson
public static void taskEndReasonToJson(TaskEndReason taskEndReason, com.fasterxml.jackson.core.JsonGenerator g) -
blockManagerIdToJson
public static void blockManagerIdToJson(BlockManagerId blockManagerId, com.fasterxml.jackson.core.JsonGenerator g) -
jobResultToJson
-
rddInfoToJson
-
storageLevelToJson
public static void storageLevelToJson(StorageLevel storageLevel, com.fasterxml.jackson.core.JsonGenerator g) -
blockStatusToJson
public static void blockStatusToJson(BlockStatus blockStatus, com.fasterxml.jackson.core.JsonGenerator g) -
executorInfoToJson
public static void executorInfoToJson(ExecutorInfo executorInfo, com.fasterxml.jackson.core.JsonGenerator g) -
blockUpdatedInfoToJson
public static void blockUpdatedInfoToJson(BlockUpdatedInfo blockUpdatedInfo, com.fasterxml.jackson.core.JsonGenerator g) -
executorResourceRequestToJson
public static void executorResourceRequestToJson(ExecutorResourceRequest execReq, com.fasterxml.jackson.core.JsonGenerator g) -
executorResourceRequestMapToJson
public static void executorResourceRequestMapToJson(scala.collection.Map<String, ExecutorResourceRequest> m, com.fasterxml.jackson.core.JsonGenerator g) -
taskResourceRequestToJson
public static void taskResourceRequestToJson(TaskResourceRequest taskReq, com.fasterxml.jackson.core.JsonGenerator g) -
taskResourceRequestMapToJson
public static void taskResourceRequestMapToJson(scala.collection.Map<String, TaskResourceRequest> m, com.fasterxml.jackson.core.JsonGenerator g) -
writeMapField
public static void writeMapField(String name, scala.collection.Map<String, String> m, com.fasterxml.jackson.core.JsonGenerator g) ------------------------------ * Util JSON serialization methods |- Parameters:
name
- (undocumented)m
- (undocumented)g
- (undocumented) -------------------------------
-
propertiesToJson
public static void propertiesToJson(Properties properties, com.fasterxml.jackson.core.JsonGenerator g) -
UUIDToJson
-
stackTraceToJson
public static void stackTraceToJson(StackTraceElement[] stackTrace, com.fasterxml.jackson.core.JsonGenerator g) -
exceptionToJson
-
sparkEventFromJson
-
sparkEventFromJson
-
stageSubmittedFromJson
public static SparkListenerStageSubmitted stageSubmittedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
stageCompletedFromJson
public static SparkListenerStageCompleted stageCompletedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
taskStartFromJson
public static SparkListenerTaskStart taskStartFromJson(com.fasterxml.jackson.databind.JsonNode json) -
taskGettingResultFromJson
public static SparkListenerTaskGettingResult taskGettingResultFromJson(com.fasterxml.jackson.databind.JsonNode json) -
executorMetricsFromJson
public static org.apache.spark.executor.ExecutorMetrics executorMetricsFromJson(com.fasterxml.jackson.databind.JsonNode maybeJson) Extract the executor metrics from JSON. -
taskEndFromJson
-
jobStartFromJson
-
jobEndFromJson
-
resourceProfileAddedFromJson
public static SparkListenerResourceProfileAdded resourceProfileAddedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
executorResourceRequestFromJson
public static ExecutorResourceRequest executorResourceRequestFromJson(com.fasterxml.jackson.databind.JsonNode json) -
taskResourceRequestFromJson
public static TaskResourceRequest taskResourceRequestFromJson(com.fasterxml.jackson.databind.JsonNode json) -
taskResourceRequestMapFromJson
public static scala.collection.Map<String,TaskResourceRequest> taskResourceRequestMapFromJson(com.fasterxml.jackson.databind.JsonNode json) -
executorResourceRequestMapFromJson
public static scala.collection.Map<String,ExecutorResourceRequest> executorResourceRequestMapFromJson(com.fasterxml.jackson.databind.JsonNode json) -
environmentUpdateFromJson
public static SparkListenerEnvironmentUpdate environmentUpdateFromJson(com.fasterxml.jackson.databind.JsonNode json) -
blockManagerAddedFromJson
public static SparkListenerBlockManagerAdded blockManagerAddedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
blockManagerRemovedFromJson
public static SparkListenerBlockManagerRemoved blockManagerRemovedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
unpersistRDDFromJson
public static SparkListenerUnpersistRDD unpersistRDDFromJson(com.fasterxml.jackson.databind.JsonNode json) -
applicationStartFromJson
public static SparkListenerApplicationStart applicationStartFromJson(com.fasterxml.jackson.databind.JsonNode json) -
applicationEndFromJson
public static SparkListenerApplicationEnd applicationEndFromJson(com.fasterxml.jackson.databind.JsonNode json) -
executorAddedFromJson
public static SparkListenerExecutorAdded executorAddedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
executorRemovedFromJson
public static SparkListenerExecutorRemoved executorRemovedFromJson(com.fasterxml.jackson.databind.JsonNode json) -
logStartFromJson
-
executorMetricsUpdateFromJson
public static SparkListenerExecutorMetricsUpdate executorMetricsUpdateFromJson(com.fasterxml.jackson.databind.JsonNode json) -
stageExecutorMetricsFromJson
public static SparkListenerStageExecutorMetrics stageExecutorMetricsFromJson(com.fasterxml.jackson.databind.JsonNode json) -
blockUpdateFromJson
public static SparkListenerBlockUpdated blockUpdateFromJson(com.fasterxml.jackson.databind.JsonNode json) -
stageInfoFromJson
--------------------------------------------------------------------- * JSON deserialization methods for classes SparkListenerEvents depend on |- Parameters:
json
- (undocumented)- Returns:
- (undocumented) ----------------------------------------------------------------------
-
taskInfoFromJson
-
accumulableInfoFromJson
-
taskMetricsFromJson
public static org.apache.spark.executor.TaskMetrics taskMetricsFromJson(com.fasterxml.jackson.databind.JsonNode json) -
taskEndReasonFromJson
-
blockManagerIdFromJson
-
jobResultFromJson
-
rddInfoFromJson
-
storageLevelFromJson
-
blockStatusFromJson
-
executorInfoFromJson
-
blockUpdatedInfoFromJson
public static BlockUpdatedInfo blockUpdatedInfoFromJson(com.fasterxml.jackson.databind.JsonNode json) -
resourcesMapFromJson
public static scala.collection.Map<String,ResourceInformation> resourcesMapFromJson(com.fasterxml.jackson.databind.JsonNode json) -
mapFromJson
public static scala.collection.Map<String,String> mapFromJson(com.fasterxml.jackson.databind.JsonNode json) -------------------------------- * Util JSON deserialization methods |- Parameters:
json
- (undocumented)- Returns:
- (undocumented) ---------------------------------
-
propertiesFromJson
-
UUIDFromJson
-
stackTraceFromJson
-
exceptionFromJson
-
toJsonString
public static String toJsonString(scala.Function1<com.fasterxml.jackson.core.JsonGenerator, scala.runtime.BoxedUnit> block)
-