Github user skonto commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22405#discussion_r217214888
  
    --- Diff: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala
 ---
    @@ -254,3 +251,18 @@ private[spark] class KubernetesClientApplication 
extends SparkApplication {
         }
       }
     }
    +
    +private[spark] object KubernetesClientApplication {
    +
    +  def getAppName(conf: SparkConf): String = 
conf.getOption("spark.app.name").getOrElse("spark")
    +
    +  def getResourceNamePrefix(appName: String): String = {
    +    val launchTime = System.currentTimeMillis()
    +    s"$appName-$launchTime"
    +      .toLowerCase
    +      .replaceAll("\\s+", "-")
    +      .replaceAll("\\.", "-")
    +      .replaceAll("[^a-z0-9\\-]", "")
    +      .replaceAll("-+", "-")
    +  }
    --- End diff --
    
    reduce dashes. for example:
    ```
    scala> "Spark   #$ d #.Pi"
    .toLowerCase
    .replaceAll("\\s+", "-")
    .replaceAll("\\.", "-")
    .replaceAll("[^a-z0-9\\-]", "")
    .replaceAll("-+", "-")
    res15: String = spark-d-pi
    ```



---

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

Reply via email to