Skip to content

Commit

Permalink
Fix collectFile saving to GCS with sort: false (#4965)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <[email protected]>
  • Loading branch information
bentsherman authored May 2, 2024
1 parent e0e9422 commit 1418553
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
*/

package nextflow.file

import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.StandardCopyOption
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap

import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import nextflow.extension.FilesEx
/**
* Helper class used to aggregate values having the same key
* to files
Expand Down Expand Up @@ -94,16 +95,13 @@ class SimpleFileCollector extends FileCollector {
@Override
void saveFile( Closure<Path> closure ) {

def result = []
Iterator<Path> itr = cache.values().iterator()
while( itr.hasNext() ) {
def item = itr.next()
def target = closure.call(item.getName())
result << Files.move(item, target, StandardCopyOption.REPLACE_EXISTING)
final item = itr.next()
final target = closure.call(item.getName())
FilesEx.moveTo(item, target)
itr.remove()
}

}


}

0 comments on commit 1418553

Please sign in to comment.