So for my use case I need to create and submit Spark streaming jobs at runtime. Having done some googling, I don't think that there's a simple way of executing Spark jobs without creating the jar file first...
My idea is to make a builder-like abstraction over Spark/Scala code, configure it at runtime by just injecting the relevant objects, and then convert that abstraction to actual raw Scala code and write it to disk.
Then I would use ProcessBuilder or something to run an sbt package on that Scala code and build the jar that way. Then I should be able to submit the job programmatically using either SparkLauncher or, again, ProcessBuilder by just running the spark-submit command.
This all seems a little idiotic, if I'm honest. Does anyone have any better ideas of submitting jobs programmatically?
The downside of using SparkLauncher is that I'll have to prepackage a huge Spark job jar with all the functionality that it can possibly do. I could then submit it using SparkLauncher and supply it with the relevant -D arguments to fix the particular functionality at runtime.