Skip to content

Commit 6008ef3

Browse files
committed
fix small file
1 parent b81b082 commit 6008ef3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

jvm-packages/xgboost4j-spark-gpu/src/main/scala/ml/dmlc/xgboost4j/scala/spark/ExternalMemory.scala

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,14 @@ private[spark] class DiskExternalMemoryIterator(val parent: String) extends Exte
150150
// TODO, make it configurable
151151
while (count < 120) {
152152
val futureOpt = taskFutures.get(path)
153-
if (futureOpt.isDefined && futureOpt.get.isCompleted) {
153+
val exist = new File(path).exists()
154+
if (futureOpt.isDefined && futureOpt.get.isCompleted && exist) {
154155
return
155156
}
156157
count += 1
157158
Thread.sleep(50)
158159
}
159-
throw new RuntimeException(s"Caching $path is not finished")
160+
throw new RuntimeException(s"The cache file $path does not exist")
160161
}
161162

162163
/**
@@ -167,13 +168,10 @@ private[spark] class DiskExternalMemoryIterator(val parent: String) extends Exte
167168
*/
168169
override def loadTable(path: String): Table = {
169170
val file = new File(path)
170-
if (!file.exists()) {
171-
throw new RuntimeException(s"The cache file ${path} doesn't exist" )
172-
}
173-
174-
checkAndWaitCachingDone(path)
175171

176172
try {
173+
checkAndWaitCachingDone(path)
174+
177175
withResource(Table.readArrowIPCChunked(file)) { reader =>
178176
val tables = ArrayBuffer.empty[Table]
179177
closeOnExcept(tables) { tables =>

0 commit comments

Comments
 (0)