Skip to content

Commit

Permalink
Add dest key
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Sep 5, 2024
1 parent 1ff720d commit b08f727
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltObserver.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class QuiltObserver implements TraceObserver {
}

static String quiltURIfromS3(String s3uri) {
println("quiltURIfromS3: $s3uri")
String[] partsArray = s3uri.split('/')
List<String> parts = new ArrayList(partsArray.toList())
parts.eachWithIndex { p, i -> println("quiltURIfromS3.parts[$i]: $p") }
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'() {
Expand Down

0 comments on commit b08f727

Please sign in to comment.