From b08f7270dbd95165fececfbedc4788ca55bce3cd Mon Sep 17 00:00:00 2001 From: "Dr. Ernie Prabhakar" <19791+drernie@users.noreply.github.com> Date: Thu, 5 Sep 2024 14:13:31 -0700 Subject: [PATCH] Add dest key --- .../src/main/nextflow/quilt/QuiltObserver.groovy | 11 ++++++++--- .../src/test/nextflow/quilt/QuiltObserverTest.groovy | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy index febf3811..e9f5b2f1 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy @@ -62,6 +62,7 @@ class QuiltObserver implements TraceObserver { } static String quiltURIfromS3(String s3uri) { + println("quiltURIfromS3: $s3uri") String[] partsArray = s3uri.split('/') List parts = new ArrayList(partsArray.toList()) parts.eachWithIndex { p, i -> println("quiltURIfromS3.parts[$i]: $p") } @@ -74,10 +75,14 @@ class QuiltObserver implements TraceObserver { parts = parts.drop(1) } String bucket = parts.remove(0) - String prefix = parts.size() > 0 ? parts.remove(0) : 'default_prefix' - String suffix = parts.size() > 0 ? parts.remove(0) : 'default_suffix' + String dest = parts.join('%2f') + println("quiltURIfromS3.bucket: $bucket dest: $dest from $parts") + String suffix = parts.size() > 1 ? parts.removeLast() : 'default_suffix' + println("quiltURIfromS3.suffix: $suffix from $parts") + String prefix = parts.size() > 0 ? parts.removeLast() : 'default_prefix' + println("quiltURIfromS3.prefix: $prefix from $parts") String base = "quilt+s3://${bucket}#package=${prefix}%2f${suffix}" - String uri = (parts.size() > 0) ? "${base}&path=${parts.join('/')}" : base + String uri = base + '&dest=' + ((dest) ?: '/') return uri } diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltObserverTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltObserverTest.groovy index d6529f70..341378a0 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltObserverTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltObserverTest.groovy @@ -69,10 +69,10 @@ class QuiltObserverTest extends QuiltSpecification { QuiltObserver.quiltURIfromS3(s3_uri) == quilt_uri where: s3_uri | quilt_uri - 's3://bucket/prefix/suffix' | 'quilt+s3://bucket#package=prefix%2fsuffix' - 's3://bucket/prefix' | 'quilt+s3://bucket#package=prefix%2fdefault_suffix' - 's3://bucket' | 'quilt+s3://bucket#package=default_prefix%2fdefault_suffix' - // 's3://bucket/folder/prefix/suffix' | 'quilt+s3://bucket#package=prefix%2fsuffix&dest=folder/prefix/suffix' + 's3://bucket/prefix/suffix' | 'quilt+s3://bucket#package=prefix%2fsuffix&dest=prefix%2fsuffix' + 's3://bucket/prefix' | 'quilt+s3://bucket#package=prefix%2fdefault_suffix&dest=prefix' + 's3://bucket' | 'quilt+s3://bucket#package=default_prefix%2fdefault_suffix&dest=/' + 's3://bucket/folder/prefix/suffix' | 'quilt+s3://bucket#package=prefix%2fsuffix&dest=folder%2fprefix%2fsuffix' } void 'should findOutputParams'() {