dongjoon-hyun commented on a change in pull request #30472:
URL: https://github.com/apache/spark/pull/30472#discussion_r535757680



##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientUtils.scala
##########
@@ -94,25 +120,41 @@ private[spark] object KubernetesClientUtils extends 
Logging {
     val confDir = Option(conf.getenv(ENV_SPARK_CONF_DIR)).orElse(
       conf.getOption("spark.home").map(dir => s"$dir/conf"))
     if (confDir.isDefined) {
-      val confFiles = listConfFiles(confDir.get)
-      logInfo(s"Spark configuration files loaded from $confDir : 
${confFiles.mkString(",")}")
-      confFiles.map { file =>
-        val source = Source.fromFile(file)(Codec.UTF8)
-        val mapping = (file.getName -> source.mkString)
-        source.close()
-        mapping
-      }.toMap
+      val confFiles = listConfFiles(confDir.get, 
conf.get(Config.CONFIG_MAP_MAXSIZE))
+      val filesSeq: Seq[Option[(String, String)]] = confFiles.map { file =>
+        try {
+          val source = Source.fromFile(file)(Codec.UTF8)
+          val mapping = Some(file.getName -> source.mkString)
+          source.close()
+          mapping
+        } catch {
+          case e: MalformedInputException =>
+            logWarning(s"skipped a non UTF-8 encoded file 
${file.getAbsolutePath}.", e)
+            None
+        }
+      }
+      val truncatedMap = truncateToSize(filesSeq.flatten, 
conf.get(Config.CONFIG_MAP_MAXSIZE))
+      logInfo(s"Spark configuration files loaded from $confDir :" +

Review comment:
       Shall we skip this if `truncatedMap` is empty?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to