-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat: support spark submit jar on k8s #4867
Conversation
.setDeployMode(sparkConfig.getDeployMode()) | ||
.setAppName(sparkConfig.getAppName()) | ||
.setVerbose(true); | ||
this.driverPodName = sparkConfig.getAppName() + "-" + System.currentTimeMillis() + "-driver"; |
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.
Using timestamp to make driverPodName unique is not enough good, UUID would be better.
If this is for pod create time recording, there is creationTimestamp in pod spec already.
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.
Using timestamp to make driverPodName unique is not enough good, UUID would be better. If this is for pod create time recording, there is creationTimestamp in pod spec already.
Thanks for reviewing the codes and changes have been made in the last commitment.
if (StringUtils.isNotBlank(master)) { | ||
if (master.equalsIgnoreCase("k8s-operator")) { | ||
clusterDescriptorAdapter = new KubernetesOperatorClusterDescriptorAdapter(executionContext); | ||
} else if (master.equalsIgnoreCase("k8s-jar")) { |
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.
In my opinion, "k8s-native" would be more suitable than "k8s-jar", which is aligned to the concept "k8s-operator".
logger.info("clusterDescriptorAdapter.getJobState is null") | ||
} else { | ||
logger.info("clusterDescriptorAdapter/getJobState is not 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.
These logs seem to be used for debugging. May be too noisy in prod env.
engineConn.getEngineConnSession match { | ||
case context: SparkEngineConnContext |
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.
It is recommended to optimize it into an if else judgment
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.
Already done in the last commitment.
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
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.
What is the purpose of the change
Support submit spark jar job on k8s.
Environment
Spark:v3.2.1
Kubernetes: v1.23
Linkis:
Test Command
Brief change log
SparkConfig.java: add
spark.kubernetes.driver.request.cores
andspark.kubernetes.executor.request.cores
related fields.ClusterDescriptorAdapterFactory.java: add new k8s submission way("
k8s-native
", different from "k8s-operator
").KubernetesApplicationClusterDescriptorAdapter.java: main features are as below
initJobId()
method converts the state of the driver pod to theSparkAppHandle.State
to determine whether the task has started.SparkOnKubernetesSubmitOnceExecutor.scala: new once executor type for k8s.
SparkEngineConnFactory.scala: add
linkis.spark.k8s.driver.request.cores
andlinkis.spark.k8s.executor.request.cores
to sparkConf.SparkEngineConnResourceFactory.scala: According to Spark Doc ,
spark.kubernetes.executor.request.cores
andspark.kubernetes.driver.request.cores
have priority overspark.executor.cores
andspark.driver.cores
. So ifspark.kubernetes.executor.request.cores
is not specified when check resources, manually assign the value ofspark.executor.cores
tospark.kubernetes.executor.request.cores
to make sure the default value ofspark.kubernetes.executor.request.cores
won't affect the tasks.SparkOnceExecutorFactory.scala: Create
SparkOnKubernetesSubmitOnceExecutor
if-k8sCluster
is specified.SparkJobProgressUtil.scala: main features are as below
podIP
params to be compatible with the spark tasks on k8s.getKubernetesSparkJobInfo()
: method for getting status of spark tasks through Spark UI exposed on driver pod’s 4040 port.Checklist