You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/06/07 12:21:54 UTC

[GitHub] [spark] skonto commented on a change in pull request #24791: update Comment for k8s applicationId

skonto commented on a change in pull request #24791: update Comment for k8s applicationId
URL: https://github.com/apache/spark/pull/24791#discussion_r291568279
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/SparkContext.scala
 ##########
 @@ -311,6 +311,7 @@ class SparkContext(config: SparkConf) extends Logging {
    *  in case of local spark app something like 'local-1433865536131'
    *  in case of YARN something like 'application_1433865536131_34483'
    *  in case of MESOS something like 'driver-20170926223339-0001'
+   *  in case of Kubernetes something like 'spark-application-1559610575898'
 
 Review comment:
   @srowen This is not true for cluster mode. In cluster mode application_id is set [here](https://github.com/apache/spark/blob/b30655bdef71f1aa85811464a9f6b61057549664/core/src/main/scala/org/apache/spark/SparkContext.scala#L554) in the Spark Context and this value is retrieved from [here](https://github.com/apache/spark/blob/b30655bdef71f1aa85811464a9f6b61057549664/core/src/main/scala/org/apache/spark/scheduler/TaskScheduler.scala#L97). But it does not default to:
   ```
     private val appId = "spark-application-" + System.currentTimeMillis
   ```
   as it is overridden in [here](https://github.com/apache/spark/blob/b30655bdef71f1aa85811464a9f6b61057549664/core/src/main/scala/org/apache/spark/scheduler/TaskSchedulerImpl.scala#L900):
   ```
     override def applicationId(): String = backend.applicationId()
   ```
   The K8s backend will set that value [here](https://github.com/apache/spark/blob/b30655bdef71f1aa85811464a9f6b61057549664/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterSchedulerBackend.scala#L74):
   ```
    conf.getOption("spark.app.id").map(_.toString).getOrElse(super.applicationId)
   ``` 
   For cluster mode the `spark.app.id` is always set [here](https://github.com/apache/spark/blob/b30655bdef71f1aa85811464a9f6b61057549664/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala#L207) to be:
   ```
   val kubernetesAppId = s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
   ```
   An example:   Spark Application Id:                       spark-3d4ef94a42e1428c9658f13573abfa38
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org