-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-44906][K8S] Make Kubernetes[Driver|Executor]Conf.annotations substitute annotations instead of feature steps
#42600
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
Conversation
…netesConf.annotations
|
|
||
| override def annotations: Map[String, String] = { | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_EXECUTOR_ANNOTATION_PREFIX) | ||
| .map { case (k, v) => (k, Utils.substituteAppNExecIds(v, appId, "")) } |
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.
where is the executorId?
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.
sry, missing the executorId param, fixed.
Is this user-facing Or just for developers |
Who want to build custom feature steps and use sparkConf#annotations, can be user and developers. |
|
Thank you for pinging me, @yaooqinn . |
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_DRIVER_ANNOTATION_PREFIX).map { | ||
| case(k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, appId, "")) | ||
| } |
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.
If you don't mind, shall we use the consistent short style like KubernetesExecutorConf, @zwangsheng ?
Kubernetes[Driver|Executor]Conf.annotations substitute annotations instead of feature steps
| assert(conf.annotations === CUSTOM_ANNOTATIONS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS.map { | ||
| case (k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, conf.appId, "")) |
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.
You can merge it into one line.
- case (k, v) =>
- (k, Utils.substituteAppNExecIds(v, conf.appId, ""))
+ case (k, v) => (k, Utils.substituteAppNExecIds(v, conf.appId, ""))| assert(conf.annotations === CUSTOM_ANNOTATIONS) | ||
| assert(conf.annotations === CUSTOM_ANNOTATIONS.map { | ||
| case (k, v) => | ||
| (k, Utils.substituteAppNExecIds(v, conf.appId, EXECUTOR_ID)) |
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.
ditto
dongjoon-hyun
left a comment
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.
Thank you for proposing this, @zwangsheng . I left a few comments.
|
Thanks for your review @dongjoon-hyun! Addressed, let me know if anything missed. |
|
|
||
| override def annotations: Map[String, String] = { | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_DRIVER_ANNOTATION_PREFIX) | ||
| .map(p => (p._1, Utils.substituteAppNExecIds(p._2, appId, ""))) |
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.
Sorry, but what I suggested (#42600 (comment)) is the following style instead of p => ....
case (k, v) => ...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.
Sorry, i misunderstood the consistent short style.
Does the following code conform
.map{ case(k, v) => (k, Utils.substituteAppNExecIds(v, appId, executorId)) }
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.
The following?
.map { case (k, v) => (k, Utils.substituteAppNExecIds(v, appId, executorId)) }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.
Yes, I mean does this format conform to the consistent short style?
.map { case (k, v) => (k, Utils.substituteAppNExecIds(v, appId, executorId)) }
|
|
||
| override def annotations: Map[String, String] = { | ||
| KubernetesUtils.parsePrefixedKeyValuePairs(sparkConf, KUBERNETES_EXECUTOR_ANNOTATION_PREFIX) | ||
| .map(p => (p._1, Utils.substituteAppNExecIds(p._2, appId, executorId))) |
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.
ditto.
|
Thank you for update, @zwangsheng . It seems that there is a minor miscommunication in the above. I added two comments. |
...rce-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala
Outdated
Show resolved
Hide resolved
…ark/deploy/k8s/KubernetesConf.scala
...rce-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala
Outdated
Show resolved
Hide resolved
…ark/deploy/k8s/KubernetesConf.scala
dongjoon-hyun
left a comment
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.
+1, LGTM. Thank you, @zwangsheng and @yaooqinn .
|
Welcome to the Apache Spark community, @zwangsheng . |
|
Thanks for your help and review, @dongjoon-hyun @yaooqinn. |
Could we add this step to the merge PR script?
Thanks @dongjoon-hyun. As his colleague, Welcome @zwangsheng too. However, I guess he's not a first-time contributor, LOL. |
|
Oh, that's a good suggestion, but it required ASF JIRA Spark PMC permission.
Here is a link. Could you try that? |
|
Oh, got it.
But, it seems that he created new JIRA ID, @yaooqinn . That's the reason why the merge script fails.
|
It appears that the committers of the Spark Jira Project are also admins. I once added someone to the contributor role. |
What changes were proposed in this pull request?
Move
Utils. SubstituteAppNExecIdslogic intoKubernetesConf.annotationsas the default logic,Why are the changes needed?
Easy for users to reuse, rather than to rewrite it again at the same logic.
When user write custom feature step and using annotations, before this pr, they should call
Utils. SubstituteAppNExecIdsonce.Does this PR introduce any user-facing change?
Yes, but no sense for user to use annotations.
How was this patch tested?
Add unit test
Was this patch authored or co-authored using generative AI tooling?
No