Skip to content

FEAT: Support for custom entrypoint in sparkeks - #137

Open
prasadlohakpure wants to merge 2 commits into
mainfrom
feat/sparkeks_entrypoint_support
Open

FEAT: Support for custom entrypoint in sparkeks#137
prasadlohakpure wants to merge 2 commits into
mainfrom
feat/sparkeks_entrypoint_support

Conversation

@prasadlohakpure

@prasadlohakpure prasadlohakpure commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

What

Adds JAR/--class entrypoint support to the Heimdall sparkeks plugin so it can run a custom-class
(Java/Scala) Spark application, not just the built-in Python SQL wrapper. Additive and opt-in — no
existing sparkeks command sets a JAR wrapper, so current behavior is unchanged.

Entrypoint strategy (internal/pkg/object/command/sparkeks/entrypoint.go) — the entrypoint-specific
part of the spec (Type / MainClass / Arguments) is dispatched behind an entrypointStrategy
interface, selected by the file extension of the command's wrapper_uri:

wrapper_uri Entrypoint Spec.Type Spec.MainClass
.py Python SQL wrapper (pre-existing) Python not set
.jar JVM JAR by main class Scala / Java (from application_type, default Scala) entry_point
anything else falls back to SQL wrapper Python not set

New optional job-context fields: parameters.entry_point (fully-qualified main class) and
parameters.application_type (Scala or Java, case-insensitive).

Also in this branch: submission-failure/unknown-state reasons are now written to job stderr, and
s3aQueryURI/s3aResultURI are precomputed once on the execution context.

Test plan

  • go build ./internal/... ./cmd/... — clean.
  • go vet ./internal/pkg/object/command/sparkeks/ — clean.
  • gofmt -l internal/pkg/object/command/sparkeks/ — clean.
  • go test ./internal/pkg/object/command/sparkeks/ — ok (existing package tests).
  • No new unit tests in this PR (the ones added earlier in the branch were removed per request).
    The JAR argument contract was verified against the deployed chipmunk JAR by running it on the
    chipmunk_eks_migration_test collection, not by unit test.

Notes / rollback

  • Rollback: revert the branch — additive and opt-in; no existing command sets a .jar wrapper_uri.
    The one non-additive piece is the properties-rewriting narrowing described above.
  • Pre-existing, unrelated: go build ./... across the whole repo reports "function main is undeclared"
    for every plugins/* package — these are -buildmode=plugin packages with no func main() and fail
    the same way on an untouched origin/main checkout. Not introduced by this PR.

Testing details:

  • Custom Scala Jar
    Job ID: 0304b4ff-b674-4b92-8b8a-2b2fd059ed6b
image
  • SparkSQL query (Backward compatible regression test)
    Job ID: 5369ba25-d7f2-437c-a28a-69b0a7d2b7d5
image

Copilot AI review requested due to automatic review settings July 29, 2026 13:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Spark EKS plugin to support JVM JAR (--class) entrypoints in addition to the existing Python SQL wrapper flow, selecting behavior based on the command context wrapper_uri file extension.

Changes:

  • Add an entrypoint strategy layer to configure SparkApplication Type / MainClass / Arguments for .jar vs .py wrappers.
  • Introduce job parameters for JAR execution (entry_point, application_type) and ensure a non-empty default Spec.Type is set before submission.
  • Improve error reporting when SparkApplication enters failed-submission/unknown states, and document the new entrypoint behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
plugins/sparkeks/README.md Documents entrypoint selection and JAR configuration.
internal/pkg/object/command/sparkeks/sparkeks.go Wires entrypoint selection into SparkApplication spec creation, adds new job parameters, sets default app type, improves error output.
internal/pkg/object/command/sparkeks/entrypoint.go Implements extension-based entrypoint strategy selection and JAR application type resolution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +99 to +103
var mainClass, applicationType string
if jobContext.Parameters != nil {
mainClass = jobContext.Parameters.EntryPoint
applicationType = jobContext.Parameters.ApplicationType
}
Comment on lines +21 to +29
// resolveJarApplicationType maps an optional configured application type (e.g. "Java", "Scala",
// case-insensitive) to its SparkApplication type, falling back to the default (Scala) when
// unset or unrecognized.
func resolveJarApplicationType(applicationType string) v1beta2.SparkApplicationType {
if t, ok := jarApplicationTypes[strings.ToLower(strings.TrimSpace(applicationType))]; ok {
return t
}
return defaultJarApplicationType
}
Comment on lines +84 to +98
```json
{
"query": "SELECT key, value FROM my_table",
"wrapper_uri": "s3://mybucket/application-assembly.jar",
"parameters": {
"entry_point": "com.org.customapplication.main",
"application_type": "Scala",
"properties": {
"spark.application.custom.path": "s3://mybucket/output/v1" //custom param to be used in jar
}
},
"return_result": false
}
```

Enable the sparkeks plugin to run custom-class (Scala/Java) Spark
applications (e.g. com.pattern.chipmunk.Writer) alongside the existing
Python SQL wrapper.

- entrypoint.go: entrypoint strategy pattern selected by wrapper_uri
  extension (.jar -> JAR/--class, .py/default -> SQL wrapper). JAR mode
  sets Spec.Type (Scala/Java via parameters.application_type, default
  Scala) and MainClass from parameters.entry_point.
- Managed positional args [appName, queryURI, user, (resultURI)] shared by
  both entrypoints; job context `arguments`, when set, is passed to the app
  verbatim so callers can match an app's exact CLI contract.
- Precompute s3a query/result URIs once on the execution context.
- Write submission-failure / unknown-state reason to job stderr.
- Default Spec.Type=Python guards templateless jobs.
- plugins/sparkeks/README.md: document JAR entrypoint support, extension
  dispatch, entry_point/application_type, and the argument contract.
@prasadlohakpure
prasadlohakpure force-pushed the feat/sparkeks_entrypoint_support branch from 427246c to de0231c Compare July 30, 2026 10:20
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