dongjoon-hyun commented on code in PR #49440:
URL: https://github.com/apache/spark/pull/49440#discussion_r1913559138
##########
connector/profiler/src/main/scala/org/apache/spark/executor/profiler/ExecutorJVMProfiler.scala:
##########
@@ -89,28 +100,34 @@ private[spark] class ExecutorJVMProfiler(conf: SparkConf,
executorId: String) ex
}
}
+ private def requireProfilerBaseDirAsDirectory(fs: FileSystem,
profilerDfsDir: String): Unit = {
+ if (!fs.getFileStatus(new Path(profilerDfsDir)).isDirectory) {
+ throw new IllegalArgumentException(
+ s"Profiler DFS base directory $profilerDfsDir is not a directory.")
+ }
+ }
+
private def startWriting(): Unit = {
- if (profilerDfsDir.isDefined) {
- val applicationId = try {
- conf.getAppId
- } catch {
- case _: NoSuchElementException => "local-" + System.currentTimeMillis
+ profilerDfsDirOpt.foreach { profilerDfsDir =>
+ val profilerDirForApp = s"$profilerDfsDir/$baseName"
+ val profileOutputFile = s"$profilerDirForApp/$profileFile"
+
+ val hadoopConf = SparkHadoopUtil.get.newConfiguration(conf)
+ val fs = Utils.getHadoopFileSystem(profilerDfsDir, hadoopConf)
+
+ requireProfilerBaseDirAsDirectory(fs, profilerDfsDir)
+
+ val profilerDirForAppPath = new Path(profilerDirForApp)
+ if (!fs.exists(profilerDirForAppPath)) {
+ // SPARK-30860: use the class method to avoid the umask causing
permission issues
+ FileSystem.mkdirs(fs, profilerDirForAppPath,
PROFILER_FOLDER_PERMISSIONS)
Review Comment:
Thank you. This is a new improvement, isn't it, @pan3793 ?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]