user2352554
user2352554

Reputation: 531

How to find the job id of an action in spark?

I want to cancel a job in spark, because sometimes it take more time and was not finished. a job is created when we call an action. for example when i call collect and it takes more time to finish. i want to cancel the job of this action. I don't use spark-submit, i create SparkContext in Scala code. and my application is a web based application based on GraphX.

How can i do this in spark?

Upvotes: 1

Views: 1040

Answers (2)

user2352554
user2352554

Reputation: 531

I found the answer,

SparkContext.CancelGroupJob() can help to solve the problem. below link introduce the solution. CancelJobGroup

Upvotes: 1

Manish
Manish

Reputation: 1157

I think you are looking for this.

val res = spark.sparkContext.applicationId
print(res)
//local-1593342096634res: String = local-1593342096634

Upvotes: 0

Related Questions