cfmcgrady commented on code in PR #1889:
URL:
https://github.com/apache/incubator-celeborn/pull/1889#discussion_r1319610105
##########
worker/src/main/scala/org/apache/celeborn/service/deploy/worker/storage/StorageManager.scala:
##########
@@ -594,22 +594,26 @@ final private[worker] class StorageManager(conf:
CelebornConf, workerSource: Abs
TimeUnit.MINUTES)
private def cleanupExpiredAppDirs(): Unit = {
+ val diskInfoAndAppDirs = disksSnapshot()
+ .filter(_.status != DiskStatus.IO_HANG)
+ .map(diskInfo =>
+ (
+ diskInfo,
+ diskInfo.dirs.filter(_.exists).flatMap(_.listFiles())))
val appIds = shuffleKeySet().asScala.map(key =>
Utils.splitShuffleKey(key)._1)
- disksSnapshot().filter(_.status != DiskStatus.IO_HANG).foreach { diskInfo
=>
- diskInfo.dirs.foreach {
- case workingDir if workingDir.exists() =>
- workingDir.listFiles().foreach { appDir =>
- // Don't delete shuffleKey's data that exist correct shuffle file
info.
- if (!appIds.contains(appDir.getName)) {
- val threadPool = diskOperators.get(diskInfo.mountPoint)
- deleteDirectory(appDir, threadPool)
- logInfo(s"Delete expired app dir $appDir.")
- }
- }
- // workingDir not exist when initializing worker on new disk
- case _ => // do nothing
- }
- }
+
+ diskInfoAndAppDirs.foreach(diskAndDir => {
+ val diskInfo = diskAndDir._1
+ val appDirs = diskAndDir._2
+ appDirs.foreach(appDir => {
+ // Don't delete shuffleKey's data that exist correct shuffle file info.
+ if (!appIds.contains(appDir.getName)) {
+ val threadPool = diskOperators.get(diskInfo.mountPoint)
+ deleteDirectory(appDir, threadPool)
+ logInfo(s"Delete expired app dir $appDir.")
+ }
+ })
+ })
Review Comment:
```suggestion
diskInfoAndAppDirs.foreach { case (diskInfo, appDirs) =>
appDirs.foreach { appDir =>
// Don't delete shuffleKey's data that exist correct shuffle file
info.
if (!appIds.contains(appDir.getName)) {
val threadPool = diskOperators.get(diskInfo.mountPoint)
deleteDirectory(appDir, threadPool)
logInfo(s"Delete expired app dir $appDir.")
}
}
}
```
--
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]