Skip to content

Commit

Permalink
[KYUUBI #5522] [BATCH] Ignore main class for PySpark batch job submis…
Browse files Browse the repository at this point in the history
…sion

### _Why are the changes needed?_

For PySpark batch jobs, the main class is not required for spark submission and should be ignored.

- Spark submit doc: https://spark.apache.org/docs/latest/submitting-applications.html
- Also reported in : https://github.com/apache/kyuubi/pull/5498/files#diff-a215909f2588cb42eb307d1bdaa73eef9e05259bb0a99099f29859235bec19bbR30

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [x] [Run test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests) locally before make a pull request

### _Was this patch authored or co-authored using generative AI tooling?_

No.

Closes #5522 from bowenliang123/pyspark-submit-ignore.

Closes #5522

c28ef86 [liangbowen] ignore main class for pyspark batch submission

Authored-by: liangbowen <liangbowen@gf.com.cn>
Signed-off-by: Bowen Liang <liangbowen@gf.com.cn>
  • Loading branch information
bowenliang123 authored and davidyuan1223 committed Oct 26, 2023
1 parent d8b808d commit 3ec73ad
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,21 @@ class BatchJobSubmission(

@VisibleForTesting
private[kyuubi] val builder: ProcBuilder = {
Option(batchType).map(_.toUpperCase(Locale.ROOT)) match {
case Some("SPARK") | Some("PYSPARK") =>
new SparkBatchProcessBuilder(
session.user,
session.sessionConf,
batchId,
batchName,
Option(resource),
className,
batchConf,
batchArgs,
getOperationLog)

case _ =>
throw new UnsupportedOperationException(s"Batch type $batchType unsupported")
val mainClass = Option(batchType).map(_.toUpperCase(Locale.ROOT)) match {
case Some("SPARK") => className
case Some("PYSPARK") => null
case _ => throw new UnsupportedOperationException(s"Batch type $batchType unsupported")
}
new SparkBatchProcessBuilder(
session.user,
session.sessionConf,
batchId,
batchName,
Option(resource),
mainClass,
batchConf,
batchArgs,
getOperationLog)
}

override def currentApplicationInfo(): Option[ApplicationInfo] = {
Expand Down

0 comments on commit 3ec73ad

Please sign in to comment.