Skip to content

feat: [KEP-107] Support options in submit_job() for SparkApplication jobs - #685

Open
Goku2099 wants to merge 5 commits into
kubeflow:mainfrom
Goku2099:options-submit_job
Open

feat: [KEP-107] Support options in submit_job() for SparkApplication jobs#685
Goku2099 wants to merge 5 commits into
kubeflow:mainfrom
Goku2099:options-submit_job

Conversation

@Goku2099

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for configuring SparkApplication jobs through the options parameter in SparkClient.submit_job().

The following SparkApplication configurations are now supported through options:

  • Labels
  • Annotations
  • NodeSelector
  • Toleration
  • DriverOption
  • ExecutorOption

Additional Changes

  • Added unit tests covering the new functionality.
  • Added an end-to-end example demonstrating SparkApplication configuration through options.

ref - #520

Goku2099 added 2 commits July 29, 2026 17:19
Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com>
Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com>
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign astefanutti for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Goku2099

Copy link
Copy Markdown
Contributor Author

@tariq-hasan

Copy link
Copy Markdown
Member

/ok-to-test
/retest

@tariq-hasan tariq-hasan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @Goku2099! Thanks for raising the PR! I have added a few comments.

Comment thread kubeflow/spark/types/options.py Outdated
Comment thread kubeflow/spark/types/options.py Outdated
Comment thread kubeflow/spark/types/options.py
Comment thread kubeflow/spark/types/options.py Outdated
Comment thread kubeflow/spark/types/options.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/utils.py

@andreyvelich andreyvelich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot for working on this, @Goku2099! 🙏

This review was performed with the help of AI tools. Please see the inline comments.

Comment thread examples/spark/batch_job_options.py Outdated
Comment thread kubeflow/spark/types/options.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/utils.py
Comment thread kubeflow/spark/backends/kubernetes/utils.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/utils.py Outdated
Comment thread kubeflow/spark/types/options_test.py Outdated
PodTemplateOverride,
Toleration,
)
from kubeflow.trainer.test.common import FAILED, SUCCESS, TestCase

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Spark tests shouldn't import trainer test helpers — kubeflow/spark/test/common.py has an identical TestCase (including expected_error) and is what every other spark test uses.

Suggested change
from kubeflow.trainer.test.common import FAILED, SUCCESS, TestCase
from kubeflow.spark.test.common import FAILED, SUCCESS, TestCase

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we move them to kubeflow.common ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@andreyvelich Good point. Since this involves reorganizing shared test utilities across multiple components, I'd prefer to keep it separate from this feature PR. I can open a follow-up issue to move the common test helpers into a shared module and update the imports accordingly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@andreyvelich I've created a tracking issue for consolidating the shared test helpers into kubeflow.common: #700 . Since this involves shared infrastructure across multiple SDK components, I'd prefer to keep it separate from this feature PR.

Comment thread kubeflow/spark/backends/kubernetes/utils.py Outdated
Comment thread kubeflow/spark/backends/base.py
Comment thread examples/spark/batch_job_options.py Outdated
Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com>
@Goku2099
Goku2099 force-pushed the options-submit_job branch from cb69ef8 to dee15a7 Compare July 30, 2026 20:55
@Goku2099

Copy link
Copy Markdown
Contributor Author

@andreyvelich - I removed the pod template override support and simplified the implementation accordingly. I also updated the batch job options example to keep it focused on demonstrating the options API: it now uses a unique job name for idempotent execution and verifies that the configured Name, Labels, Annotations, NodeSelector, and Toleration are applied to the created SparkApplication.

Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com>
Comment thread examples/spark/batch_job_options.py
Comment thread kubeflow/spark/api/spark_client.py
Comment thread kubeflow/spark/backends/kubernetes/utils.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/backend.py
Comment thread kubeflow/spark/backends/kubernetes/backend.py Outdated
Comment thread kubeflow/spark/types/options.py
Comment thread kubeflow/spark/types/options.py
Comment thread kubeflow/spark/backends/base.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/backend_test.py
Comment thread kubeflow/spark/backends/kubernetes/utils_test.py Outdated
Comment thread kubeflow/spark/backends/kubernetes/utils_test.py Outdated
Comment thread examples/spark/batch_job_options.py Outdated
Comment thread examples/spark/batch_job_options.py
Signed-off-by: Sameer_yadav <159073326+Goku2099@users.noreply.github.com>
@Goku2099

Goku2099 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @andreyvelich , I've addressed all of the review comments, Could you please take another look when you have a chance? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants