Skip to content
This repository has been archived by the owner on Feb 17, 2024. It is now read-only.

Commit

Permalink
Fixes #91 Delete temporary files between RDDs
Browse files Browse the repository at this point in the history
  • Loading branch information
phymbert committed Sep 28, 2021
1 parent d79ea0c commit 4197e8c
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private[search] class SearchRDDIndexer[S: ClassTag](sc: SparkContext,
protected def streamPartitionIndexZip(context: TaskContext, searchRDDPartition: SearchPartitionIndex[S]): Iterator[Array[Byte]] = {
val localIndexDirPath = new File(searchRDDPartition.indexDir)
val targetPath = new File(localIndexDirPath.getParent, s"${localIndexDirPath.getName}.zip")
context.addTaskCompletionListener[Unit](_ => FileUtils.delete(targetPath))
zipPartition(localIndexDirPath.toPath, new FileOutputStream(targetPath))

new InterruptibleIterator[Array[Byte]](context, new FileInputStreamIterator(targetPath))
Expand Down

0 comments on commit 4197e8c

Please sign in to comment.