Skip to content
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 submit pyspark once job on k8s and add clusterlabel to combinedlabel #4906

Merged
merged 7 commits into from
Sep 21, 2023

Conversation

lenoxzhao
Copy link
Contributor

@lenoxzhao lenoxzhao commented Sep 14, 2023

What is the purpose of the change

  • support submit pyspark once job on k8s.
  • change combinedUserCreatorEngineTypeLabel to combinedResourceLabel`
  • add ClusterLabel to CombinedResourceLabel.
  • Yarn-default won't combined into CombinedResourceLabel if wds.linkis.combined.without.yarn.default is set to true(default).

Test command:

linkis-cli --mode once \
-engineType spark-3.2.1 \
-labelMap engineConnMode=once \
-jobContentMap runType='py' \
-sourceMap jobName=OnceJobTest \
-k8sCluster 'K8S-default' \
-confMap spark.app.name='spark-submit-py' \
-confMap spark.app.resource='local:///opt/spark/examples/src/main/python/pi.py' \
-confMap spark.submit.deployMode='cluster' \
-confMap spark.master='k8s-native' \
-confMap linkis.spark.k8s.serviceAccount='spark' \
-confMap linkis.spark.k8s.master.url='k8s://https://172.31.226.155:6443' \
-confMap linkis.spark.k8s.config.file='/home/hadoop/.kube/config' \
-confMap linkis.spark.k8s.imagePullPolicy='IfNotPresent' \
-confMap linkis.spark.k8s.namespace='default' \
-confMap linkis.spark.k8s.image="apache/spark-py:v3.2.1" \
-confMap spark.submit.pyFiles='local:///opt/spark/examples/src/main/python/wordcount.py'

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the Linkis mailing list first)
  • If this is a code change: I have written unit tests to fully verify the new behavior.

@@ -23,4 +23,7 @@ public class LabelManagerConf {

public static final String LONG_LIVED_LABEL =
CommonVars.apply("wds.linkis.label.node.long.lived.label.keys", "tenant").getValue();

public static final boolean COMBINED_WITHOUT_YARN_DEFAULT =
CommonVars.apply("wds.linkis.combined.without.yarn.default", true).getValue();
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove prefix of wds

@@ -247,8 +247,7 @@ public ResultResource requestResource(List<Label<?>> labels, NodeResource resour

List<PersistenceLock> persistenceLocks = new ArrayList<>();
EMInstanceLabel emInstanceLabel = labelContainer.getEMInstanceLabel();
CombinedLabel userCreatorEngineTypeLabel =
labelContainer.getCombinedUserCreatorEngineTypeLabel();
CombinedLabel userCreatorEngineTypeLabel = labelContainer.getCombinedResourceLabel();
Copy link
Collaborator

Choose a reason for hiding this comment

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

rename userCreatorEngineTypeLabel is better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename userCreatorEngineTypeLabel is better

Already rename it.

private String getK8sMasterUrl(ExternalResourceProvider provider) {
Map<String, Object> configMap = provider.getConfigMap();
String k8sMasterUrl = (String) configMap.get("k8sMasterUrl");
if (StringUtils.isEmpty(k8sMasterUrl)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use isBlank instead of isEmpty

String k8sMasterUrl = getK8sMasterUrl(provider);
try {
String k8sConfig = (String) configMap.get("k8sConfig");
if (StringUtils.isNotEmpty(k8sConfig)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use isNotBlank instead of isNotEmpty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use isNotBlank instead of isNotEmpty

Aready fix it.

Copy link
Collaborator

@guoshupei guoshupei left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

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

LGTM.

@peacewong peacewong merged commit 89a653d into apache:master Sep 21, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants