Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting app run id for a Spark job

Tags:

I'd like, from where I run a Spark job, to get the unique id of that job.

Via the Spark master node website, I can see that id. It's something like:

ID: app-20140429125304-0452

Is there any way to get this, when creating a running a job? Maybe via the SparkContext?

like image 320
Greg Avatar asked Apr 30 '14 02:04

Greg


People also ask

Is there any way to get Spark application ID while running a job?

Is there any way to get the Spark Job Id that is associated with a running Task (preferably using TaskContext or SparkEnv)? @FRG96 (Customer)​ , Honestly, there is no easy way to do this. Your only option is to set up cluster log delivery, which will give you access to the cluster's event log file.

What is Spark App ID?

applicationId. A unique identifier for the Spark application. Its format depends on the scheduler implementation. in case of local spark app something like 'local-1433865536131' in case of YARN something like 'application_1433865536131_34483'

How do I enable debug in Spark submit?

Also how to setup debug mode in spark-shelI. You can pass your own "log4j. properties" path to log messages and pass it to your spark shell command. Then run the spark-shell as following then you should see DEBUG messages.


1 Answers

yes, exactly as you said:

sc.applicationId
res0: String = app-20150224184813-11531

(This is spark 1.2)

See API doc at

  • https://spark.apache.org/docs/1.6.1/api/scala/index.html#org.apache.spark.SparkContext
like image 187
Yana K. Avatar answered Oct 08 '22 05:10

Yana K.