Skip to content

Conversation

@Yikun
Copy link
Member

@Yikun Yikun commented Nov 18, 2021

What changes were proposed in this pull request?

Remove redundant Pod label addtions in driver and executor.

Why are the changes needed?

These labels are already included by conf.labels as preset labels, we don't need do a extra addition.

Does this PR introduce any user-facing change?

NO

How was this patch tested?

UT passed:
Especially:

assert(conf.labels === Map(
SPARK_VERSION_LABEL -> SPARK_VERSION,
SPARK_EXECUTOR_ID_LABEL -> EXECUTOR_ID,
SPARK_APP_ID_LABEL -> KubernetesTestConf.APP_ID,
SPARK_APP_NAME_LABEL -> KubernetesConf.getAppNameLabel(conf.appName),
SPARK_ROLE_LABEL -> SPARK_POD_EXECUTOR_ROLE,
SPARK_RESOURCE_PROFILE_ID_LABEL -> DEFAULT_RESOURCE_PROFILE_ID.toString) ++ CUSTOM_LABELS)
assert(conf.annotations === CUSTOM_ANNOTATIONS)

@SparkQA
Copy link

SparkQA commented Nov 18, 2021

Test build #145390 has finished for PR 34646 at commit eb04493.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@Yikun Yikun marked this pull request as ready for review November 18, 2021 13:39
@SparkQA
Copy link

SparkQA commented Nov 18, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49864/

@SparkQA
Copy link

SparkQA commented Nov 18, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/49864/

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit. editition -> addition in the PR title and description, @Yikun ?

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR aims to more than a simple removing. We had better make the PR clear about what it's doing in the code.

@Yikun Yikun changed the title [SPARK-37372][K8S] Remove redundant Pod label edition [SPARK-37372][K8S] Removing redundant label addition and refactoring related test case Nov 19, 2021
@Yikun
Copy link
Member Author

Yikun commented Nov 19, 2021

@dongjoon-hyun Thanks for you patient review, and I rename the title to Removing redundant label addition and refactoring related test case, and update the PR description.

@Yikun Yikun requested a review from dongjoon-hyun November 19, 2021 07:53
@Yikun
Copy link
Member Author

Yikun commented Nov 29, 2021

@dongjoon-hyun Would you mind taking a look again? Or I misundertanded your suggestion, it's not enough to update the PR message, I should split this PR to 2 PRs:

  1. Remove the redundant edition, then passed new added the ut "assert(executor.pod.getMetadata.getLabels === conf.labels.asJava)", and existing conf.label ut.
  2. then rename CUSTOM_DRIVER_LABELS?

Or maybe there were some misleading, I clarify in #34646 (comment) , anyway, much thanks for your review.

@Yikun
Copy link
Member Author

Yikun commented Dec 10, 2021

@dongjoon-hyun Friendly ping...Thanks

Run SparkR on simple dataframe.R example *** FAILED ***
Test decommissioning with dynamic allocation & shuffle cleanups *** FAILED ***

Unrelated failed.

@Yikun Yikun force-pushed the SPARK-labels-improve branch from ad5341d to 526b359 Compare January 14, 2022 08:50
@Yikun Yikun changed the title [SPARK-37372][K8S] Removing redundant label addition and refactoring related test case [SPARK-37372][K8S] Removing redundant label addition Jan 14, 2022
@Yikun
Copy link
Member Author

Yikun commented Jan 14, 2022

I separate the test refactoring in #35209 to make PR clear.

@Yikun Yikun marked this pull request as draft January 14, 2022 09:07
.addToLabels(
SPARK_APP_NAME_LABEL,
KubernetesConf.getAppNameLabel(kubernetesConf.appName)
)
Copy link
Member Author

@Yikun Yikun Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, these labels are ready included in KubernetesExecutorConf.labels:

override def labels: Map[String, String] = {
val presetLabels = Map(
SPARK_VERSION_LABEL -> SPARK_VERSION,
SPARK_EXECUTOR_ID_LABEL -> executorId,
SPARK_APP_ID_LABEL -> appId,
SPARK_APP_NAME_LABEL -> KubernetesConf.getAppNameLabel(appName),
SPARK_ROLE_LABEL -> SPARK_POD_EXECUTOR_ROLE,
SPARK_RESOURCE_PROFILE_ID_LABEL -> resourceProfileId.toString)

This also addresses the comment in https://github.com/apache/spark/pull/33508/files#r682842336

.editOrNewMetadata()
.withName(driverPodName)
.addToLabels(conf.labels.asJava)
.addToLabels(SPARK_APP_NAME_LABEL, KubernetesConf.getAppNameLabel(conf.appName))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this label are ready included by KubernetesDriverConf.labels:

override def labels: Map[String, String] = {
val presetLabels = Map(
SPARK_VERSION_LABEL -> SPARK_VERSION,
SPARK_APP_ID_LABEL -> appId,
SPARK_APP_NAME_LABEL -> KubernetesConf.getAppNameLabel(appName),
SPARK_ROLE_LABEL -> SPARK_POD_DRIVER_ROLE)
val driverCustomLabels = KubernetesUtils.parsePrefixedKeyValuePairs(
sparkConf, KUBERNETES_DRIVER_LABEL_PREFIX)

@Yikun Yikun marked this pull request as ready for review January 14, 2022 10:24
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you for simplification, @Yikun .
Merged to master for Apache Spark 3.3.

@Yikun
Copy link
Member Author

Yikun commented Jan 15, 2022

@dongjoon-hyun Thanks!

dchvn pushed a commit to dchvn/spark that referenced this pull request Jan 19, 2022
### What changes were proposed in this pull request?
Remove redundant Pod label addtions in driver and executor.

### Why are the changes needed?
These labels are already included by conf.labels as preset labels, we don't need do a extra addition.

### Does this PR introduce _any_ user-facing change?
NO

### How was this patch tested?
UT passed:
Especially:
https://github.com/apache/spark/blob/a3886ba976469bef0dfafc3da8686a53c5a59d95/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala#L157-L164

Closes apache#34646 from Yikun/SPARK-labels-improve.

Authored-by: Yikun Jiang <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
dongjoon-hyun pushed a commit that referenced this pull request Feb 2, 2022
…r/ExecutorFeatureStepSuite

### What changes were proposed in this pull request?
- Rename DRIVER_LABELS to CUSTOM_DRIVER_LABELS, LABELS  to CUSTOM_EXECUTORS_LABELS, make their names more clear.
- Refactoring on preset labels and add preset labels test.

### Why are the changes needed?
There are two type Pod label in current implementations: [preset label](https://github.com/apache/spark/blob/068d53bd5d89c96bf0cdb05d3ec7f2f023cf3875/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala#L158-L165) set by spark and custom label set by user, but there are some mix up in testcase, so this PR just fix it.

Also see realted: #34646 (comment)

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
UT

Closes #35209 from Yikun/SPARK-37908.

Authored-by: Yikun Jiang <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants