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

[SPARK-37145][K8S] Add support for extending user feature steps with configuration #34924

Closed
wants to merge 2 commits into from

Conversation

Yikun
Copy link
Member

@Yikun Yikun commented Dec 16, 2021

What changes were proposed in this pull request?

This patch adds the support for extending user feature steps with configuration.

Before this patch user can only add feature step like:

  • class TestStep extends KubernetesFeatureConfigStep

After this patch user can add feature step with configuration like:

  • class TestStep extends KubernetesFeatureConfigStep
  • class TestStepWithK8SConf(conf: KubernetesConf) extends KubernetesFeatureConfigStep
  • class TestStepWithDriverConf(conf: KubernetesDriverConf) extends KubernetesFeatureConfigStep
  • class TestStepWithExecConf(conf: KubernetesExecutorConf) extends KubernetesFeatureConfigStep

Why are the changes needed?

In #30206 , a developer API for custom feature steps has been added, but it didn't support initialize user feature step with kubernetes conf (like KubernetesConf/KubernetesDriverConf/KubernetesExecutorConf).

In most of scenarios, users want to make corresponding changes in their feature steps according to the configuration. Such as, the customized scheduler scenario, user wants to configure pod according to passed job configuration.

Does this PR introduce any user-facing change?

Improve the developer API for for custom feature steps.

How was this patch tested?

  • Added UT
  • Runing k8s integration test manaully: build/sbt -Pkubernetes -Pkubernetes-integration-tests -Dtest.exclude.tags=minikube,r "kubernetes-integration-tests/test

@SparkQA
Copy link

SparkQA commented Dec 16, 2021

Test build #146292 has finished for PR 34924 at commit 5ab974c.

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

@SparkQA
Copy link

SparkQA commented Dec 16, 2021

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

@SparkQA
Copy link

SparkQA commented Dec 16, 2021

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

@Yikun Yikun marked this pull request as ready for review December 17, 2021 03:49
@Yikun
Copy link
Member Author

Yikun commented Dec 17, 2021

cc @dongjoon-hyun @holdenk

@holdenk
Copy link
Contributor

holdenk commented Dec 17, 2021

So excited :D I'm busy with log4j stuff but I'll take some cycles next week :)

@Yikun
Copy link
Member Author

Yikun commented Dec 21, 2021

@holdenk Sure, thanks!

@Yikun Yikun force-pushed the SPARK-37145 branch 3 times, most recently from c55aee1 to 5305da8 Compare January 14, 2022 13:29
@Yikun
Copy link
Member Author

Yikun commented Jan 14, 2022

Added the exception message and UT for loadFeatureStep. Ready for review again.


@Since("3.3.0")
def loadFeatureStep(conf: KubernetesConf, className: String): KubernetesFeatureConfigStep = {
val constructors = Utils.classForName(className).getConstructors
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking about how we could avoid reflections here and my idea is the following:

  1. Extending KubernetesFeatureConfigStep with a new method def init(config: KubernetesConf) {}
  2. Introducing two new traits (KubernetesDriverFeatureConfigStep/KubernetesExecutorFeatureConfigStep) where the init accepts KubernetesDriverConf and KubernetesExecutorConf respectively. The init in the derived classes this way is not overriding the init of KubernetesFeatureConfigStep. So we cannot create a common loadFeatureStep where KubernetesConf is passed but it can be a function with generic parameter.

And finally we can extend the doc of KUBERNETES_DRIVER_POD_FEATURE_STEPS and KUBERNETES_EXECUTOR_POD_FEATURE_STEPS to mention those two specific traits.

This way the custom feature step's API will contain a clue that configs can be used to initialize.

WDYT?

Copy link
Member Author

@Yikun Yikun Jan 28, 2022

Choose a reason for hiding this comment

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

Thanks for your suggestion.

avoid reflections here and my idea is the following

Yes, it's a little bit complex and some hack taste, but the advantage would be same experience and interface with native feature step, and init way is simple, but perhaps bring some different interface for user.

If I understand correctly your idea, this #35345 migth be the alternative way you mentioend. Could you take a look on it? @attilapiros

Copy link
Contributor

Choose a reason for hiding this comment

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

Today I was busy with some internal stuffs so I just had time to quickly scan it and although it looks better I will have some comments but only on Monday...

Copy link
Member Author

Choose a reason for hiding this comment

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

Much thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants