-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[WIP][SPARK-42206][CORE] Omit "Task Executor Metrics" field in eventlogs if values are all zero #39770
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
Closed
JoshRosen
wants to merge
4
commits into
apache:master
from
JoshRosen:SPARK-42206-omit-empty-task-executor-metrics-from-eventlogs
Closed
[WIP][SPARK-42206][CORE] Omit "Task Executor Metrics" field in eventlogs if values are all zero #39770
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ import org.scalatest.exceptions.TestFailedException | |
|
|
||
| import org.apache.spark._ | ||
| import org.apache.spark.executor._ | ||
| import org.apache.spark.internal.config._ | ||
| import org.apache.spark.metrics.ExecutorMetricType | ||
| import org.apache.spark.rdd.{DeterministicLevel, RDDOperationScope} | ||
| import org.apache.spark.resource._ | ||
|
|
@@ -43,7 +44,7 @@ import org.apache.spark.shuffle.MetadataFetchFailedException | |
| import org.apache.spark.storage._ | ||
|
|
||
| class JsonProtocolSuite extends SparkFunSuite { | ||
| import JsonProtocol.toJsonString | ||
| import JsonProtocol._ | ||
| import JsonProtocolSuite._ | ||
|
|
||
| test("SparkListenerEvent") { | ||
|
|
@@ -368,6 +369,18 @@ class JsonProtocolSuite extends SparkFunSuite { | |
| assert(newMetrics.peakExecutionMemory == 0) | ||
| } | ||
|
|
||
| test("Task Executor Metrics backward compatibility") { | ||
| // The "Task Executor Metrics" field was introduced in Spark 3.0.0 in SPARK-23429 | ||
| val oldJson = taskEndJsonString.removeField("Task Executor Metrics") | ||
| val oldTaskEnd = JsonProtocol.taskEndFromJson(oldJson) | ||
| val newTaskEnd = JsonProtocol.taskEndFromJson(taskEndJsonString) | ||
| assert(oldTaskEnd.taskExecutorMetrics != newTaskEnd.taskExecutorMetrics) | ||
| assert(oldTaskEnd.taskExecutorMetrics.isSet()) | ||
| ExecutorMetricType.metricToOffset.keys.foreach { metric => | ||
| assert(oldTaskEnd.taskExecutorMetrics.getMetricValue(metric) == 0) | ||
| } | ||
| } | ||
|
|
||
| test("StorageLevel backward compatibility") { | ||
| // "Use Off Heap" was added in Spark 3.4.0 | ||
| val level = StorageLevel( | ||
|
|
@@ -778,6 +791,26 @@ class JsonProtocolSuite extends SparkFunSuite { | |
| |}""".stripMargin | ||
| assert(JsonProtocol.sparkEventFromJson(unknownFieldsJson) === expected) | ||
| } | ||
|
|
||
| test("SPARK-42206: skip logging of all-zero Task Executor Metrics") { | ||
| val allZeroTaskExecutorMetrics = new ExecutorMetrics(Array.emptyLongArray) | ||
|
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.
|
||
| val taskEnd = taskEndFromJson(taskEndJsonString) | ||
| .copy(taskExecutorMetrics = allZeroTaskExecutorMetrics) | ||
|
|
||
| // Test new default behavior: | ||
| val newOptions = new JsonProtocolOptions( | ||
| new SparkConf().set(EVENT_LOG_INCLUDE_ALL_ZERO_TASK_EXECUTOR_METRICS, false)) | ||
| val newJson = sparkEventToJsonString(taskEnd, newOptions) | ||
| assertEquals(taskEnd, taskEndFromJson(newJson)) | ||
| assert(!newJson.has("Task Executor Metrics")) | ||
|
|
||
| // Test backwards compatibility flag: | ||
| val oldOptions = new JsonProtocolOptions( | ||
| new SparkConf().set(EVENT_LOG_INCLUDE_ALL_ZERO_TASK_EXECUTOR_METRICS, true)) | ||
| val oldJson = sparkEventToJsonString(taskEnd, oldOptions) | ||
| assertEquals(taskEnd, taskEndFromJson(oldJson)) | ||
| assert(oldJson.has("Task Executor Metrics")) | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
This is the same flagging pattern used in #39763, so these PRs will conflict and will need updating after one of them merges. I've marked this PR as WIP pending discussion on how / whether we want to flag this change (perhaps I'm being overly conservative and we'd be okay with saying that third-party code directly consuming event logs should update itself to be robust to the new / changed format and not go out of our way to provide escape hatches for this use-case).