Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include remote path in FileHolder #5911

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1940,7 +1940,7 @@ class TaskProcessor {
if( item instanceof Path || coerceToPath ) {
def path = normalizeToPath(item)
def target = executor.isForeignFile(path) ? batch.addToForeign(path) : path
def holder = new FileHolder(target)
def holder = new FileHolder(path, target)
files << holder
}
else {
Expand Down
15 changes: 14 additions & 1 deletion modules/nf-commons/src/main/nextflow/file/FileHolder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,23 @@ package nextflow.file
import java.nio.file.FileSystems
import java.nio.file.Path

import com.google.common.hash.Hasher
import groovy.transform.CompileStatic
import groovy.transform.EqualsAndHashCode
import groovy.transform.PackageScope
import groovy.transform.ToString
import groovy.util.logging.Slf4j
import nextflow.util.CacheFunnel
import nextflow.util.CacheHelper
import nextflow.util.CacheHelper.HashMode
/**
* Implements a special {@code Path} used to stage files in the work area
*/
@Slf4j
@ToString(includePackage = false, includeNames = true)
@EqualsAndHashCode
@CompileStatic
class FileHolder {
class FileHolder implements CacheFunnel {

final def sourceObj

Expand Down Expand Up @@ -66,10 +70,19 @@ class FileHolder {
new FileHolder( this.sourceObj, this.storePath, stageName )
}

Path getSourcePath() {
sourceObj instanceof Path ? sourceObj : null
}

Path getStorePath() { storePath }

String getStageName() { stageName }

@Override
Hasher funnel(Hasher hasher, HashMode mode) {
return CacheHelper.hasher(hasher, sourceObj, mode)
}

@PackageScope
static FileHolder get( def path, def name = null ) {
Path storePath = path as Path
Expand Down
4 changes: 0 additions & 4 deletions modules/nf-commons/src/main/nextflow/util/HashBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import nextflow.ISession;
import nextflow.extension.Bolts;
import nextflow.extension.FilesEx;
import nextflow.file.FileHolder;
import nextflow.io.SerializableMarker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -162,9 +161,6 @@ else if( value instanceof Collection)
for( Object item : ((Collection)value) )
with(item);

else if( value instanceof FileHolder )
with(((FileHolder) value).getSourceObj());

else if( value instanceof Path )
hashFile(hasher, (Path)value, mode, basePath);

Expand Down
Loading