turboFei commented on code in PR #3345:
URL: https://github.com/apache/celeborn/pull/3345#discussion_r2165199188
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/profiler/JVMProfiler.scala:
##########
@@ -77,4 +82,24 @@ class JVMProfiler(conf: CelebornConf) extends Logging {
})
}
}
+
+ private def extractionDir: Path = {
+ val extractionDirectory = applicationsDir
+ if (extractionDirectory.toFile.exists()) {
+ extractionDirectory
+ } else {
+ Utils.createTempDir(conf.workerWorkingDir, "profiler").toPath
+ }
+ }
+
+ private def applicationsDir: Path = {
+ if (Utils.isLinux) {
+ val xdgDataHome = System.getenv("XDG_DATA_HOME")
+ if (xdgDataHome != null && xdgDataHome.nonEmpty) return
Paths.get(xdgDataHome)
+ return Paths.get(System.getProperty("user.home"), ".local", "share")
+ } else if (Utils.isMac)
+ return Paths.get(System.getProperty("user.home"), "Library",
"Application Support")
Review Comment:
wrap with `{}`?
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/profiler/JVMProfiler.scala:
##########
@@ -48,7 +50,10 @@ class JVMProfiler(conf: CelebornConf) extends Logging {
val profiler: Option[AsyncProfiler] = {
Option(
- if (enableProfiler && AsyncProfilerLoader.isSupported)
AsyncProfilerLoader.load() else null)
+ if (enableProfiler && AsyncProfilerLoader.isSupported) {
+ AsyncProfilerLoader.setExtractionDirectory(extractionDir)
+ AsyncProfilerLoader.load()
+ } else null)
Review Comment:
wrap with `{}`?
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/profiler/JVMProfiler.scala:
##########
@@ -77,4 +82,24 @@ class JVMProfiler(conf: CelebornConf) extends Logging {
})
}
}
+
+ private def extractionDir: Path = {
+ val extractionDirectory = applicationsDir
+ if (extractionDirectory.toFile.exists()) {
+ extractionDirectory
+ } else {
+ Utils.createTempDir(conf.workerWorkingDir, "profiler").toPath
Review Comment:
can it just be `conf.workerWorkingDir/profiler` instead of temp dir?
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/profiler/JVMProfiler.scala:
##########
@@ -77,4 +82,24 @@ class JVMProfiler(conf: CelebornConf) extends Logging {
})
}
}
+
+ private def extractionDir: Path = {
+ val extractionDirectory = applicationsDir
+ if (extractionDirectory.toFile.exists()) {
+ extractionDirectory
+ } else {
+ Utils.createTempDir(conf.workerWorkingDir, "profiler").toPath
+ }
+ }
+
+ private def applicationsDir: Path = {
Review Comment:
How about adding comment in the code?
--
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]