-
Notifications
You must be signed in to change notification settings - Fork 982
[KYUUBI #5680] Optimize Spark engine pod name generation #5695
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
|
Hi @Ocean22, thanks for the PR. There is also an original purpose for So, since we are now touching this part, I suggest we make it as simple as possible. for example, the appUser is not necessary here as both YARN UI or Spark History UI display with a USER field, uuid is not necessary as it is also in the app tags, |
zwangsheng
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.
We can just simply changed appendPodName logic in SparkProcessBuilder#appendPodNameConf
- remove
kyuubiprefix - only append
engineRefId, whenappNamenot contains it.
| builder = engineType match { | ||
| case SPARK_SQL => | ||
| conf.setIfMissing(SparkProcessBuilder.APP_KEY, defaultEngineName) | ||
| conf.set(SparkProcessBuilder.APP_KEY, generateAppKey(conf.getOption(SparkProcessBuilder.APP_KEY).getOrElse(null))) |
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.
IMO, if user set spark app name, we should not over write this, so let's keep setIfMissing here.
|
Thanks for guidance,I will continue to improve it when I have free time. |
If the `appName` contains the `engineRefId`, it indicates that this `appName` is the `defaultEngineNmae` from `EngineRef.scala`, not set by the user.
|
@yaooqinn @zwangsheng Hi, following our previous discussion, I have changed a way to handle this issue. |
Sorry, it still need some else change,I still need to do more testing |
|
zwangsheng
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.
Sorry for late review, we should determine if resolvedResourceName carries engine ref id before determining if it's too long.
| lazy val resolvedResourceName = s"kyuubi-${getResourceNamePrefix(appName, engineRefId)}-driver" | ||
| if (forciblyRewrite || resolvedResourceName.length > DRIVER_POD_NAME_MAX_LENGTH) { | ||
| s"kyuubi-$engineRefId-driver" | ||
| } else if (appName.contains(engineRefId)){ | ||
| getResourceNamePrefix(appName, "driver") | ||
| } else { | ||
| resolvedResourceName | ||
| } |
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.
| lazy val resolvedResourceName = s"kyuubi-${getResourceNamePrefix(appName, engineRefId)}-driver" | |
| if (forciblyRewrite || resolvedResourceName.length > DRIVER_POD_NAME_MAX_LENGTH) { | |
| s"kyuubi-$engineRefId-driver" | |
| } else if (appName.contains(engineRefId)){ | |
| getResourceNamePrefix(appName, "driver") | |
| } else { | |
| resolvedResourceName | |
| } | |
| val resourceNamePrefix = if (appName.contains(engineRefId)) { | |
| getResourceNamePrefix(appName, "") | |
| } else { | |
| getResourceNamePrefix(appName, engineRefId) | |
| } | |
| val resolvedResourceName = if (resourceNamePrefix.startsWith("kyuubi")) { | |
| s"$resourceNamePrefix-driver" | |
| } else { | |
| s"kyuubi-$resourceNamePrefix-driver" | |
| } | |
| if (forciblyRewrite || resolvedResourceName.length > DRIVER_POD_NAME_MAX_LENGTH) { | |
| s"kyuubi-$engineRefId-driver" | |
| } else { | |
| resolvedResourceName | |
| } |
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.
zwangsheng
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.
LGTM, also FYI @pan3793
pan3793
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.
LGTM, though @yaooqinn's suggestion is not applied, we can do it in the future
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #5695 +/- ##
============================================
- Coverage 61.46% 61.34% -0.13%
Complexity 23 23
============================================
Files 604 608 +4
Lines 35697 35941 +244
Branches 4889 4940 +51
============================================
+ Hits 21942 22048 +106
- Misses 11380 11495 +115
- Partials 2375 2398 +23 ☔ View full report in Codecov by Sentry. |
|
how about this? - private def getResourceNamePrefix(appName: String, engineRefId: String): String = {
- s"$appName-$engineRefId"
+ private def getResourceNamePrefix(appName: String, engineRefId: Option[String]): String = {
+ engineRefId.map(refId => s"$appName-$refId").getOrElse(appName) |
|
|
@Ocean22 sorry I missed the message, it's correct, please push it |
@pan3793 Hi,the code passed the test,and it's the result |
Good,I will push it later. |
Optimize engine pod name generation.
kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala
Outdated
Show resolved
Hide resolved
|
@Ocean22 could you please provide a Public Name and email (which should be linked to your GitHub account), e.g. |
### _Why are the changes needed?_ Close #5680 **Background**: 1) In default case, when kyuubi submit spark sql engine on kubernetes, will generate spark driver pod name with "kyuubi-${app_name}-${engine_ref_id}-driver". 2) And app_name will be "kyuubi_${shareLevel}_${engineType}_${appUser}_${engineRefId}" if not set by user. 3) In result, we may get spark driver pod name with "kyuubi-kyuubi-${shareLevel}-${engineType}-${appUser}-${engineRefId}-${engineRefId}-driver". 4) We were hoping for a more concise and readable name, such as "kyuubi-${shareLevel}-${engineType}-${appUser}-${app_name}-${engineRefId}-driver". ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate **1) Before modification:** Left is unset `spark.app.name`, and right is set to “ocean”  **2) Modify the code**  **3) Build module and get the jar**  **4) Build a new images**  **5) After modification:**  - [ ] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request ### _Was this patch authored or co-authored using generative AI tooling?_ No Closes #5695 from Ocean22/master. Closes #5680 6dbac57 [Cheng Pan] Update kyuubi-server/src/main/scala/org/apache/kyuubi/util/KubernetesUtils.scala 5ddc9f6 [no 会 English] Update KubernetesUtils.scala b685b60 [no 会 English] Update KubernetesUtils.scala 6a64e17 [no 会 English] Update KubernetesUtils.scala 1335bbd [no 会 English] Update EngineRef.scala f2af955 [no 会 English] Update KubernetesUtils.scala 891f172 [no 会 English] Update KubernetesUtils.scala c20b755 [no 会 English] Update EngineRef.scala 09f3ed1 [no 会 English] Update EngineRef.scala 64bd2c1 [no 会 English] Update EngineRef.scala Lead-authored-by: Ocean22 <1058853680@qq.com> Co-authored-by: no 会 English <45907917+Ocean22@users.noreply.github.com> Co-authored-by: Cheng Pan <pan3793@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org> (cherry picked from commit 25eb53d) Signed-off-by: Cheng Pan <chengpan@apache.org>
|
Thanks, merged to master/1.8 |








Why are the changes needed?
Close #5680
Background:
How was this patch tested?
Add some test cases that check the changes thoroughly including negative and positive cases if possible
Add screenshots for manual tests if appropriate

1) Before modification:
Left is unset
spark.app.name, and right is set to “ocean”2) Modify the code

3) Build module and get the jar

4) Build a new images

5) After modification:

Was this patch authored or co-authored using generative AI tooling?
No