diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd1cd27..1ea4212b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## [0.7.7] 2024-01-24 +- Properly implement and test getFilename() - Pre-install package if "&path" present -- Add `path-input` integration test +- Add and pass `path-input` integration test - Add unit test for "&path=" Quilt+ URIs ## [0.7.6] 2024-01-10 UNOFFICIAL diff --git a/main.path.nf b/main.path.nf index 1d47ada4..7d91f301 100644 --- a/main.path.nf +++ b/main.path.nf @@ -20,9 +20,7 @@ process CHECK_INPUT { """ ls -l echo $input - if [ "$input" != "README.md" ]; then - cp -f $input README.md - fi + cp -f $input ../../tmp """ } diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy index 56c620e0..93464879 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy @@ -33,7 +33,6 @@ import java.nio.file.LinkOption import java.nio.file.NoSuchFileException import java.nio.file.OpenOption import java.nio.file.Path -import java.nio.file.Paths import java.nio.file.StandardOpenOption import java.nio.file.attribute.BasicFileAttributeView import java.nio.file.attribute.BasicFileAttributes @@ -48,7 +47,6 @@ import groovy.util.logging.Slf4j import nextflow.Global import nextflow.Session import nextflow.quilt.jep.QuiltParser -import nextflow.quilt.jep.QuiltPackage import nextflow.file.FileSystemTransferAware import nextflow.file.CopyOptions import nextflow.file.FileHelper @@ -101,28 +99,22 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr */ boolean canUpload(Path source, Path target) { - log.debug "QuiltFileSystemProvider.canUpload: ${source} -> ${target}" + // log.debug "QuiltFileSystemProvider.canUpload: ${source} -> ${target}" return FileSystems.getDefault().equals(source.getFileSystem()) && target instanceof QuiltPath } boolean canDownload(Path source, Path target) { - log.debug "QuiltFileSystemProvider.canDownload: ${source} -> ${target}" + // log.debug "QuiltFileSystemProvider.canDownload: ${source} -> ${target}" return source instanceof QuiltPath && FileSystems.getDefault().equals(target.getFileSystem()) } void download(Path remoteFile, Path localDestination, CopyOption... options) throws IOException { - log.debug "QuiltFileSystemProvider.download: ${remoteFile} -> ${localDestination}" + // log.debug "QuiltFileSystemProvider.download: ${remoteFile} -> ${localDestination}" QuiltPath qPath = asQuiltPath(remoteFile) Path cachedFile = qPath.localPath() - log.debug "download.cachedFile: ${cachedFile} [${qPath}]" - - QuiltPackage pkg = qPath.pkg() - String pathName = pkg.parsed.getPath() - - Path localRoot = localDestination.getParent().getParent().getParent().getParent() - Path finalDestination = Paths.get(localRoot.toUriString(), 'tmp', pathName) - log.debug "download.finalDestination: ${finalDestination} [${localRoot}]" - FileHelper.deletePath(finalDestination) // FIXME: be more intelligent about this + if (!Files.exists(cachedFile)) { + throw new NoSuchFileException(remoteFile.toString()) + } final CopyOptions opts = CopyOptions.parse(options) // delete target if it exists and REPLACE_EXISTING is specified @@ -133,15 +125,11 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr throw new FileAlreadyExistsException(localDestination.toString()) } - log.info "download.Files.copy -> ${localDestination}" Files.copy(cachedFile, localDestination, options) - // log.info "download.Files.copy -> ${finalDestination}" - // Files.copy(localDestination, finalDestination, options) - log.info 'download.Files copied' } void upload(Path localFile, Path remoteDestination, CopyOption... options) throws IOException { - log.debug "QuiltFileSystemProvider.upload: ${localFile} -> ${remoteDestination}" + // log.debug "QuiltFileSystemProvider.upload: ${localFile} -> ${remoteDestination}" final CopyOptions opts = CopyOptions.parse(options) // delete target if it exists and REPLACE_EXISTING is specified if (opts.replaceExisting()) { @@ -303,7 +291,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override QuiltPath getPath(URI uri) { QuiltParser parsed = QuiltParser.forURI(uri) - log.debug("QuiltFileSystemProvider.getPath`[${uri}]") + // log.debug("QuiltFileSystemProvider.getPath`[${uri}]") final fs = getFileSystem(parsed.quiltIDS(), true) return new QuiltPath(fs, parsed) } @@ -334,7 +322,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override SeekableByteChannel newByteChannel( Path path, Set options, FileAttribute... attrs) throws IOException { - //log.debug("Creating `newByteChannel`: ${path} <- ${options}") + // log.debug("Creating `newByteChannel`: ${path} <- ${options}") final modeWrite = options.contains(WRITE) || options.contains(APPEND) final QuiltPath qPath = asQuiltPath(path) @@ -348,7 +336,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr attributesCache = [:] // reset cache notifyFilePublish(qPath) } - //log.debug("\tOpening channel to: $installedPath") + // log.debug("\tOpening channel to: $installedPath") FileChannel channel = FileChannel.open(installedPath, options) return channel } @@ -374,10 +362,10 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override DirectoryStream newDirectoryStream(Path obj, DirectoryStream.Filter filter) throws IOException { final qPath = asQuiltPath(obj) - //final dirPath = qPath.localPath() - //Files.newDirectoryStream(dirPath, filter) + // final dirPath = qPath.localPath() + // Files.newDirectoryStream(dirPath, filter) - //log.debug("QuiltFileSystemProvider.newDirectoryStream[${qPath.file_key()}]: ${qPath}") + // log.debug("QuiltFileSystemProvider.newDirectoryStream[${qPath.file_key()}]: ${qPath}") return new DirectoryStream() { @@ -396,7 +384,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override void createDirectory(Path dir, FileAttribute... attrs) throws IOException { final path = asQuiltPath(dir).localPath() - //log.debug("Calling createDirectory[${path}]: ${dir} ") + // log.debug("Calling createDirectory[${path}]: ${dir} ") Files.createDirectories(path) } /* groovylint-enable BuilderMethodWithSideEffects */ @@ -411,7 +399,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override void copy(Path from, Path to, CopyOption... options) throws IOException { - //log.debug("Attempting `copy`: ${from} -> ${to}") + // log.debug("Attempting `copy`: ${from} -> ${to}") assert provider(from) == provider(to) if (from == to) { return // nothing to do -- just return @@ -447,7 +435,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override void checkAccess(Path path, AccessMode... modes) throws IOException { - //log.debug("Calling `checkAccess`: ${path}") + // log.debug("Calling `checkAccess`: ${path}") checkRoot(path) QuiltPath qPath = asQuiltPath(path) readAttributes(qPath, QuiltFileAttributes) @@ -458,7 +446,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override def V getFileAttributeView(Path path, Class type, LinkOption... options) { - //log.debug("Calling `getFileAttributeView`: ${path}") + // log.debug("Calling `getFileAttributeView`: ${path}") checkRoot(path) if (type == BasicFileAttributeView || type == QuiltFileAttributesView) { QuiltPath qPath = asQuiltPath(path) @@ -471,7 +459,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override def A readAttributes(Path path, Class type, LinkOption... options) throws IOException { - //log.debug 'BasicFileAttributes QuiltFileSystemProvider.readAttributes()' + // log.debug 'BasicFileAttributes QuiltFileSystemProvider.readAttributes()' def attr = attributesCache.get(path) if (attr) { return attr @@ -484,15 +472,15 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr attributesCache[path] = result return result } - //log.debug("readAttributes: File ${qPath.localPath()} not found") + // log.debug("readAttributes: File ${qPath.localPath()} not found") throw new NoSuchFileException(qPath.toUriString()) } throw new UnsupportedOperationException("Not a valid Quilt Storage file attribute type: $type") - } + } @Override Map readAttributes(Path path, String attributes, LinkOption... options) throws IOException { - //log.debug 'Map QuiltFileSystemProvider.readAttributes()' + // log.debug 'Map QuiltFileSystemProvider.readAttributes()' throw new UnsupportedOperationException("Operation Map 'readAttributes' is not supported by QuiltFileSystem") } diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltPath.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltPath.groovy index 3dba412f..d6b8ac90 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltPath.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltPath.groovy @@ -219,11 +219,8 @@ final class QuiltPath implements Path, Comparable { @Override String toString() { - println("toString.parsed[isFileName=$isFileName]: $parsed") - String filename = paths.size() > 0 ? paths[-1] : '' - println("toString:filename: ${filename}") if (isFileName) { - return filename + return paths.size() > 0 ? paths[-1] : '' } return parsed.toString() }