-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-41423][CORE] Protobuf serializer for StageDataWrapper #39192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
2b7f1ef
0dedace
f0ba3fc
65e8e02
f89b17a
809d5ff
21bbfca
e28a727
4bd85f8
59b5749
fac1115
3def54d
955b22a
bab6770
6cb476f
8aeb9c5
f8e6162
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -421,3 +421,214 @@ message SparkPlanGraphWrapper { | |
| repeated SparkPlanGraphNodeWrapper nodes = 2; | ||
| repeated SparkPlanGraphEdge edges = 3; | ||
| } | ||
|
|
||
| message StageDataWrapper { | ||
| StageData info = 1; | ||
| repeated int64 job_ids = 2; | ||
| map<string, int64> locality = 3; | ||
| } | ||
|
|
||
| message TaskData { | ||
| int64 task_id = 1; | ||
| int32 index = 2; | ||
| int32 attempt = 3; | ||
| int32 partition_id = 4; | ||
| int64 launch_time = 5; | ||
| optional int64 result_fetch_start = 6; | ||
| optional int64 duration = 7; | ||
| string executor_id = 8; | ||
| string host = 9; | ||
| string status = 10; | ||
| string task_locality = 11; | ||
| bool speculative = 12; | ||
| repeated AccumulableInfo accumulator_updates = 13; | ||
| optional string error_message = 14; | ||
| optional TaskMetrics task_metrics = 15; | ||
| map<string, string> executor_logs = 16; | ||
| int64 scheduler_delay = 17; | ||
| int64 getting_result_time = 18; | ||
| } | ||
|
|
||
| enum StageStatus { | ||
| STAGE_STATUS_UNSPECIFIED = 0; | ||
| STAGE_STATUS_ACTIVE = 1; | ||
| STAGE_STATUS_COMPLETE = 2; | ||
| STAGE_STATUS_FAILED = 3; | ||
| STAGE_STATUS_PENDING = 4; | ||
| STAGE_STATUS_SKIPPED = 5; | ||
| } | ||
|
|
||
| message StageData { | ||
| StageStatus status = 1; | ||
| int64 stage_id = 2; | ||
| int32 attempt_id = 3; | ||
| int32 num_tasks = 4; | ||
| int32 num_active_tasks = 5; | ||
| int32 num_complete_tasks = 6; | ||
| int32 num_failed_tasks = 7; | ||
| int32 num_killed_tasks = 8; | ||
| int32 num_completed_indices = 9; | ||
|
|
||
| optional int64 submission_time = 10; | ||
| optional int64 first_task_launched_time = 11; | ||
| optional int64 completion_time = 12; | ||
| optional string failure_reason = 13; | ||
|
|
||
| int64 executor_deserialize_time = 14; | ||
| int64 executor_deserialize_cpu_time = 15; | ||
| int64 executor_run_time = 16; | ||
| int64 executor_cpu_time = 17; | ||
| int64 result_size = 18; | ||
| int64 jvm_gc_time = 19; | ||
| int64 result_serialization_time = 20; | ||
| int64 memory_bytes_spilled = 21; | ||
| int64 disk_bytes_spilled = 22; | ||
| int64 peak_execution_memory = 23; | ||
| int64 input_bytes = 24; | ||
| int64 input_records = 25; | ||
| int64 output_bytes = 26; | ||
| int64 output_records = 27; | ||
| int64 shuffle_remote_blocks_fetched = 28; | ||
| int64 shuffle_local_blocks_fetched = 29; | ||
| int64 shuffle_fetch_wait_time = 30; | ||
| int64 shuffle_remote_bytes_read = 31; | ||
| int64 shuffle_remote_bytes_read_to_disk = 32; | ||
| int64 shuffle_local_bytes_read = 33; | ||
| int64 shuffle_read_bytes = 34; | ||
| int64 shuffle_read_records = 35; | ||
| int64 shuffle_write_bytes = 36; | ||
| int64 shuffle_write_time = 37; | ||
| int64 shuffle_write_records = 38; | ||
|
|
||
| string name = 39; | ||
| optional string description = 40; | ||
| string details = 41; | ||
| string scheduling_pool = 42; | ||
|
|
||
| repeated int64 rdd_ids = 43; | ||
| repeated AccumulableInfo accumulator_updates = 44; | ||
| map<int64, TaskData> tasks = 45; | ||
| map<string, ExecutorStageSummary> executor_summary = 46; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
| optional SpeculationStageSummary speculation_summary = 47; | ||
| map<string, int32> killed_tasks_summary = 48; | ||
| int32 resource_profile_id = 49; | ||
| optional ExecutorMetrics peak_executor_metrics = 50; | ||
| optional TaskMetricDistributions task_metrics_distributions = 51; | ||
| optional ExecutorMetricsDistributions executor_metrics_distributions = 52; | ||
| } | ||
|
|
||
| message TaskMetrics { | ||
| int64 executor_deserialize_time = 1; | ||
| int64 executor_deserialize_cpu_time = 2; | ||
| int64 executor_run_time = 3; | ||
| int64 executor_cpu_time = 4; | ||
| int64 result_size = 5; | ||
| int64 jvm_gc_time = 6; | ||
| int64 result_serialization_time = 7; | ||
| int64 memory_bytes_spilled = 8; | ||
| int64 disk_bytes_spilled = 9; | ||
| int64 peak_execution_memory = 10; | ||
| InputMetrics input_metrics = 11; | ||
| OutputMetrics output_metrics = 12; | ||
| ShuffleReadMetrics shuffle_read_metrics = 13; | ||
| ShuffleWriteMetrics shuffle_write_metrics = 14; | ||
| } | ||
|
|
||
| message InputMetrics { | ||
| int64 bytes_read = 1; | ||
| int64 records_read = 2; | ||
| } | ||
|
|
||
| message OutputMetrics { | ||
| int64 bytes_written = 1; | ||
| int64 records_written = 2; | ||
| } | ||
|
|
||
| message ShuffleReadMetrics { | ||
| int64 remote_blocks_fetched = 1; | ||
| int64 local_blocks_fetched = 2; | ||
| int64 fetch_wait_time = 3; | ||
| int64 remote_bytes_read = 4; | ||
| int64 remote_bytes_read_to_disk = 5; | ||
| int64 local_bytes_read = 6; | ||
| int64 records_read = 7; | ||
| } | ||
|
|
||
| message ShuffleWriteMetrics { | ||
| int64 bytes_written = 1; | ||
| int64 write_time = 2; | ||
| int64 records_written = 3; | ||
| } | ||
|
|
||
| message TaskMetricDistributions { | ||
| repeated double quantiles = 1; | ||
| repeated double duration = 2; | ||
| repeated double executor_deserialize_time = 3; | ||
| repeated double executor_deserialize_cpu_time = 4; | ||
| repeated double executor_run_time = 5; | ||
| repeated double executor_cpu_time = 6; | ||
| repeated double result_size = 7; | ||
| repeated double jvm_gc_time = 8; | ||
| repeated double result_serialization_time = 9; | ||
| repeated double getting_result_time = 10; | ||
| repeated double scheduler_delay = 11; | ||
| repeated double peak_execution_memory = 12; | ||
| repeated double memory_bytes_spilled = 13; | ||
| repeated double disk_bytes_spilled = 14; | ||
| InputMetricDistributions input_metrics = 15; | ||
| OutputMetricDistributions output_metrics = 16; | ||
| ShuffleReadMetricDistributions shuffle_read_metrics = 17; | ||
| ShuffleWriteMetricDistributions shuffle_write_metrics = 18; | ||
| } | ||
|
|
||
| message InputMetricDistributions { | ||
| repeated double bytes_read = 1; | ||
| repeated double records_read = 2; | ||
| } | ||
|
|
||
| message OutputMetricDistributions { | ||
| repeated double bytes_written = 1; | ||
| repeated double records_written = 2; | ||
| } | ||
|
|
||
| message ShuffleReadMetricDistributions { | ||
| repeated double read_bytes = 1; | ||
| repeated double read_records = 2; | ||
| repeated double remote_blocks_fetched = 3; | ||
| repeated double local_blocks_fetched = 4; | ||
| repeated double fetch_wait_time = 5; | ||
| repeated double remote_bytes_read = 6; | ||
| repeated double remote_bytes_read_to_disk = 7; | ||
| repeated double total_blocks_fetched = 8; | ||
| } | ||
|
|
||
| message ShuffleWriteMetricDistributions { | ||
| repeated double write_bytes = 1; | ||
| repeated double write_records = 2; | ||
| repeated double write_time = 3; | ||
| } | ||
|
|
||
| message ExecutorMetricsDistributions { | ||
| repeated double quantiles = 1; | ||
|
|
||
| repeated double task_time = 2; | ||
| repeated double failed_tasks = 3; | ||
| repeated double succeeded_tasks = 4; | ||
| repeated double killed_tasks = 5; | ||
| repeated double input_bytes = 6; | ||
| repeated double input_records = 7; | ||
| repeated double output_bytes = 8; | ||
| repeated double output_records = 9; | ||
| repeated double shuffle_read = 10; | ||
| repeated double shuffle_read_records = 11; | ||
| repeated double shuffle_write = 12; | ||
| repeated double shuffle_write_records = 13; | ||
| repeated double memory_bytes_spilled = 14; | ||
| repeated double disk_bytes_spilled = 15; | ||
| ExecutorPeakMetricsDistributions peak_memory_metrics = 16; | ||
| } | ||
|
|
||
| message ExecutorPeakMetricsDistributions { | ||
| repeated double quantiles = 1; | ||
| repeated ExecutorMetrics executor_metrics = 2; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.status.protobuf | ||
|
|
||
| import java.util.{List => JList} | ||
|
|
||
| import scala.collection.mutable.ArrayBuffer | ||
|
|
||
| import org.apache.spark.status.api.v1.AccumulableInfo | ||
| import org.apache.spark.status.protobuf.Utils.getOptional | ||
|
|
||
| object AccumulableInfoSerializer { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's put the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So that we don't need to have
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
|
||
| private[protobuf] def serialize( | ||
| input: AccumulableInfo): StoreTypes.AccumulableInfo = { | ||
| val builder = StoreTypes.AccumulableInfo.newBuilder() | ||
| .setId(input.id) | ||
| .setName(input.name) | ||
| .setValue(input.value) | ||
| input.update.foreach(builder.setUpdate) | ||
| builder.build() | ||
| } | ||
|
|
||
| private[protobuf] def deserialize( | ||
| updates: JList[StoreTypes.AccumulableInfo]): ArrayBuffer[AccumulableInfo] = { | ||
| val accumulatorUpdates = new ArrayBuffer[AccumulableInfo](updates.size()) | ||
| updates.forEach { update => | ||
| accumulatorUpdates.append(new AccumulableInfo( | ||
| id = update.getId, | ||
| name = update.getName, | ||
| update = getOptional(update.hasUpdate, update.getUpdate), | ||
| value = update.getValue)) | ||
| } | ||
| accumulatorUpdates | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.spark.status.protobuf | ||
|
|
||
| import org.apache.spark.status.api.v1.ExecutorStageSummary | ||
| import org.apache.spark.status.protobuf.Utils.getOptional | ||
|
|
||
| object ExecutorStageSummarySerializer { | ||
|
|
||
| private[protobuf] def serialize(input: ExecutorStageSummary): StoreTypes.ExecutorStageSummary = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| val builder = StoreTypes.ExecutorStageSummary.newBuilder() | ||
| .setTaskTime(input.taskTime) | ||
| .setFailedTasks(input.failedTasks) | ||
| .setSucceededTasks(input.succeededTasks) | ||
| .setKilledTasks(input.killedTasks) | ||
| .setInputBytes(input.inputBytes) | ||
| .setInputRecords(input.inputRecords) | ||
| .setOutputBytes(input.outputBytes) | ||
| .setOutputRecords(input.outputRecords) | ||
| .setShuffleRead(input.shuffleRead) | ||
| .setShuffleReadRecords(input.shuffleReadRecords) | ||
| .setShuffleWrite(input.shuffleWrite) | ||
| .setShuffleWriteRecords(input.shuffleWriteRecords) | ||
| .setMemoryBytesSpilled(input.memoryBytesSpilled) | ||
| .setDiskBytesSpilled(input.diskBytesSpilled) | ||
| .setIsBlacklistedForStage(input.isBlacklistedForStage) | ||
| .setIsExcludedForStage(input.isExcludedForStage) | ||
| input.peakMemoryMetrics.map { m => | ||
| builder.setPeakMemoryMetrics(ExecutorMetricsSerializer.serialize(m)) | ||
| } | ||
| builder.build() | ||
| } | ||
|
|
||
| private[protobuf] def deserialize( | ||
| binary: StoreTypes.ExecutorStageSummary): ExecutorStageSummary = { | ||
| val peakMemoryMetrics = | ||
| getOptional(binary.hasPeakMemoryMetrics, | ||
| () => ExecutorMetricsSerializer.deserialize(binary.getPeakMemoryMetrics)) | ||
| new ExecutorStageSummary( | ||
| taskTime = binary.getTaskTime, | ||
| failedTasks = binary.getFailedTasks, | ||
| succeededTasks = binary.getSucceededTasks, | ||
| killedTasks = binary.getKilledTasks, | ||
| inputBytes = binary.getInputBytes, | ||
| inputRecords = binary.getInputRecords, | ||
| outputBytes = binary.getOutputBytes, | ||
| outputRecords = binary.getOutputRecords, | ||
| shuffleRead = binary.getShuffleRead, | ||
| shuffleReadRecords = binary.getShuffleReadRecords, | ||
| shuffleWrite = binary.getShuffleWrite, | ||
| shuffleWriteRecords = binary.getShuffleWriteRecords, | ||
| memoryBytesSpilled = binary.getMemoryBytesSpilled, | ||
| diskBytesSpilled = binary.getDiskBytesSpilled, | ||
| isBlacklistedForStage = binary.getIsBlacklistedForStage, | ||
| peakMemoryMetrics = peakMemoryMetrics, | ||
| isExcludedForStage = binary.getIsExcludedForStage) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional mapis not supported by pbThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, hmm... should we encapsulate this map?
such as
also cc @gengliangwang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply a map is OK here. An empty map should make no difference with
Nonehere.