Pass parameters to the jar when using spark launcher

Oleg Yarin

I am trying to create an executable jar which is using a spark launcher to run another jar with data transformation task(this jar creates spark session).

I need to pass java parameters(some java arrays) to the jar which is executed by the launcher.

object launcher {
  @throws[Exception]
  // How do I pass parameters to spark_job_with_spark_session.jar
  def main(args: Array[String]): Unit = {
    val handle = new SparkLauncher()
      .setAppResource("spark_job_with_spark_session.jar")
      .setVerbose(true)
      .setMaster("local[*]")
      .setConf(SparkLauncher.DRIVER_MEMORY, "4g")
      .launch()
  }
}

How can I do that?

Alper t. Turker

need to pass java parameters(some java arrays)

It is equivalent to executing spark-submit so you cannot pass Java objects directly. Use app args

addAppArgs(String... args)

to pass application arguments, and parse them in your app.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Pass comma separated argument to spark jar in AWS EMR using CLI

override config settings when using a fat jar for spark on EMR

guava jar conflict when using ElasticSearch on Spark job

Pass parameters to Spark Insert script

Is it possible to pass through commandline parameters to the "execute launcher" action?

How to pass parameters into constructors when using IoC containers?

how to pass parameters of a function when using timeit.Timer()

How to pass parameters to a controller's constructor when using `<fx:include>`?

how to pass multiple parameters in url when using vuejs

How to pass XGBoost fit parameters when using OneVsRestClassifier?

How to pass custom parameters when creating a call using a TwiML App

How to pass column names in selectExpr through one or more string parameters in spark using scala?

Using subshell to pass parameters with spaces

Using $implict to pass multiple parameters

Using GWT History to pass parameters?

Pass parameters without using QueryString

How to pass parameters / properties to Spark jobs with spark-submit

Regarding org.apache.spark.sql.AnalysisException error when creating a jar file using Scala

Specify parameters for launcher program

Spark job not running when jar is in HDFS

How to pass parameters for a specific Schema registry when using Kafka Avro Console Consumer?

How do I pass GET parameters to my AWS Lambda function when using an HTTP endpoint?

Entity Framework Core how do you pass a list of parameters when using fromSql

How could the Vue app pass the additional parameters to the event listener when using vm.$once()?

Is there a way to pass parameters when using vaadin Page.getCurrent().open() method?

In React Router, how do you pass route parameters when using browser history push?

Cannot pass parameters to servlet when using multipart/form-data enctype in form

Pass constant parameters to function when using scipy minimize on more than one parameter

Problem with using https://allorigins.win/ to Pass Cors when my link has parameters in it