Skip to content

Include remote path in FileHolder #5911

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 @@ -80,6 +80,7 @@ import nextflow.file.FileHelper
import nextflow.file.FileHolder
import nextflow.file.FilePatternSplitter
import nextflow.file.FilePorter
import nextflow.file.RemoteFileHolder
import nextflow.plugin.Plugins
import nextflow.processor.tip.TaskTipProvider
import nextflow.script.BaseScript
Expand Down Expand Up @@ -1939,9 +1940,14 @@ 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)
files << holder
if (executor.isForeignFile(path)) {
def target = batch.addToForeign(path)
def holder = new RemoteFileHolder(target, path)
files << holder
} else {
def holder = new FileHolder(path)
files << holder
}
}
else {
files << normalizeInputToFile(item, "input.${++count}")
Expand Down
55 changes: 55 additions & 0 deletions modules/nf-commons/src/main/nextflow/file/RemoteFileHolder.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2013-2024, Seqera Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package nextflow.file

import java.nio.file.Path

import groovy.transform.CompileStatic
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import groovy.util.logging.Slf4j

import nextflow.file.FileHolder

/**
* Implements a special {@code Path} used to stage files in the work area
*/
@Slf4j
@ToString(includePackage = false, includeNames = true)
@EqualsAndHashCode
@CompileStatic
class RemoteFileHolder extends FileHolder {

final Path origPath

RemoteFileHolder( Path inputFile, Path origPath ) {
super(inputFile)
this.origPath = origPath
}

RemoteFileHolder( def origin, Path path, Path origPath ) {
super(origin, path)
this.origPath = origPath
}

protected RemoteFileHolder( def source, Path store, def stageName, Path origPath ) {
super(source, store, stageName)
this.origPath = origPath
}

Path getOrigPath() { origPath }
}
Loading