Skip to content

Commit 24903f2

Browse files
Include remote path in FileHolder (#5911)
--------- Signed-off-by: Robrecht Cannoodt <[email protected]> Signed-off-by: Ben Sherman <[email protected]> Co-authored-by: Ben Sherman <[email protected]>
1 parent b0fe0a9 commit 24903f2

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

modules/nextflow/src/main/groovy/nextflow/processor/TaskProcessor.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1946,7 +1946,7 @@ class TaskProcessor {
19461946
if( item instanceof Path || coerceToPath ) {
19471947
final path = resolvePath(item)
19481948
final target = executor.isForeignFile(path) ? foreignFiles.addToForeign(path) : path
1949-
final holder = new FileHolder(target)
1949+
final holder = new FileHolder(path, target)
19501950
files << holder
19511951
}
19521952
else {

modules/nf-commons/src/main/nextflow/file/FileHolder.groovy

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@ package nextflow.file
2020
import java.nio.file.FileSystems
2121
import java.nio.file.Path
2222

23+
import com.google.common.hash.Hasher
2324
import groovy.transform.CompileStatic
2425
import groovy.transform.EqualsAndHashCode
2526
import groovy.transform.PackageScope
2627
import groovy.transform.ToString
2728
import groovy.util.logging.Slf4j
29+
import nextflow.util.CacheFunnel
30+
import nextflow.util.CacheHelper
31+
import nextflow.util.CacheHelper.HashMode
2832
/**
2933
* Implements a special {@code Path} used to stage files in the work area
3034
*/
3135
@Slf4j
3236
@ToString(includePackage = false, includeNames = true)
3337
@EqualsAndHashCode
3438
@CompileStatic
35-
class FileHolder {
39+
class FileHolder implements CacheFunnel {
3640

3741
final def sourceObj
3842

@@ -52,7 +56,7 @@ class FileHolder {
5256
assert path != null
5357

5458
this.sourceObj = origin
55-
this.storePath = path
59+
this.storePath = real(path)
5660
this.stageName = norm(path.getFileName())
5761
}
5862

@@ -66,10 +70,19 @@ class FileHolder {
6670
new FileHolder( this.sourceObj, this.storePath, stageName )
6771
}
6872

73+
Path getSourcePath() {
74+
sourceObj instanceof Path ? sourceObj : null
75+
}
76+
6977
Path getStorePath() { storePath }
7078

7179
String getStageName() { stageName }
7280

81+
@Override
82+
Hasher funnel(Hasher hasher, HashMode mode) {
83+
return CacheHelper.hasher(hasher, sourceObj, mode)
84+
}
85+
7386
@PackageScope
7487
static FileHolder get( def path, def name = null ) {
7588
Path storePath = path as Path

modules/nf-commons/src/main/nextflow/util/HashBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import nextflow.ISession;
4545
import nextflow.extension.Bolts;
4646
import nextflow.extension.FilesEx;
47-
import nextflow.file.FileHolder;
4847
import nextflow.io.SerializableMarker;
4948
import org.slf4j.Logger;
5049
import org.slf4j.LoggerFactory;
@@ -162,9 +161,6 @@ else if( value instanceof Collection)
162161
for( Object item : ((Collection)value) )
163162
with(item);
164163

165-
else if( value instanceof FileHolder )
166-
with(((FileHolder) value).getSourceObj());
167-
168164
else if( value instanceof Path )
169165
hashFile(hasher, (Path)value, mode, basePath);
170166

0 commit comments

Comments
 (0)