Skip to content

Commit

Permalink
fix addSessionMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Oct 23, 2024
1 parent bc3aaf8 commit e01c083
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 32 deletions.
5 changes: 0 additions & 5 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltPathify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,14 @@ class QuiltPathify {
}

boolean findQuiltPath(String filename) {
println("findQuiltPath.filename: $filename")
// check for '#package' in filename
if (!filename.toString().contains('#package')) {
println("findQuiltPath: no package in $filename")
return false
}

uri = "${QuiltParser.SCHEME}://${filename}"
println("findQuiltPath.uri: $uri")
path = QuiltPathFactory.parse(this.uri)
println("findQuiltPath.path: $path")
pkg = path.pkg()
println("findQuiltPath.pkg: $pkg")
return true
}

Expand Down
2 changes: 0 additions & 2 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ ${nextflow}
QuiltProduct(QuiltPathify pathify, Session session) {
this.path = pathify.path
this.pkg = pathify.pkg
println("QuiltProduct: ${pkg} -> ${pkg.toUriString()}")
this.msg = pkg.toString()
this.meta = pkg.meta + [pkg: msg, time_start: now()]
this.session = session
Expand Down Expand Up @@ -164,7 +163,6 @@ ${nextflow}
}

boolean shouldSkip(key) {
println("shouldSkip[$key]: meta:${pkg.meta} uri:${pkg.toUriString()}")
return pkg.meta.containsKey(key) && pkg.meta[key] == KEY_SKIP
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,10 @@ class QuiltPackage {
}

String toUriString() {
println(' QuiltPackage.toUriString')
return parsed.toUriString()
}

String toKey() {
println(' QuiltPackage.toKey:true')
return parsed.toPackageString(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ class QuiltParser {
if (tag) { pkg += ":$tag" }
str += "#package=${pkg.replace('/', '%2f')}"
}
println(" toPackageString[forKey:$forKey, metadata:$metadata]: ${str}")
return str
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,15 @@ class QuiltPathifyTest extends QuiltSpecification {
String meta = "meta=${now}"
String uriWith = uniqueQueryURI(meta)
String uriWithout = uriWith.replace("?$meta", '')
println("pathify1.uriWith: $uriWith")
QuiltPathify pathify1 = getPathify(uriWith)
println("pathify1.uri: ${pathify1.uri}")
println("pathify1.uriString: ${pathify1.pkg.toUriString()}")

then:
uriWith.contains(meta)
pathify1.uri == uriWith
pathify1.pkg.toUriString() == uriWith

when:
println('pathify2.uriWithout: $uriWithout')
QuiltPathify pathify2 = getPathify(uriWithout)
println("pathify2.uri: ${pathify2.uri}")
println("pathify2.uriString: ${pathify2.pkg.toUriString()}")

then:
pathify2.pkgKey() == pathify1.pkgKey()
Expand Down
2 changes: 0 additions & 2 deletions plugins/nf-quilt/src/test/nextflow/quilt/QuiltPkgTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class QuiltPkgTest extends QuiltSpecification {
String baseURI = SpecURI().replace('source', suffix)
QuiltPathFactory factory = new QuiltPathFactory()
QuiltPath qpath = factory.parseUri(baseURI)
println("Parsed: $qpath")
QuiltPackage pkg = qpath.pkg()
println("Package: $pkg")
return pkg
}

Expand Down
11 changes: 4 additions & 7 deletions plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,16 @@ import spock.lang.Unroll
class QuiltProductTest extends QuiltSpecification {

QuiltProduct makeProductFromUrl(String url, boolean success = false) {
println("makeProductFromUrl[success:$success]: ${url}")
WorkflowMetadata wf_meta = GroovyMock(WorkflowMetadata) {
toMap() >> [start:'2022-01-01', complete:'2022-01-02']
}
QuiltPath path = QuiltPathFactory.parse(url)
println("path: ${path}")
QuiltPathify pathify = new QuiltPathify(path)
println("pathify: ${pathify}")
Session session = GroovyMock(Session) {
getWorkflowMetadata() >> wf_meta
getParams() >> [outdir: url]
isSuccess() >> success
config >> [quilt: [metadata: [cfkey: 'cfval']], runName: 'my-run']
}
return new QuiltProduct(pathify, session)
}
Expand Down Expand Up @@ -113,8 +111,8 @@ class QuiltProductTest extends QuiltSpecification {
QuiltProduct product = makeProduct('readme=SKIP')
expect:
!product.shouldSkip(QuiltProduct.KEY_SKIP)
!product.shouldSkip(QuiltProduct.KEY_META)
product.shouldSkip(QuiltProduct.KEY_README)
product.shouldSkip(QuiltProduct.KEY_META)

!makeProduct('?readme=now').shouldSkip()
}
Expand Down Expand Up @@ -269,20 +267,19 @@ class QuiltProductTest extends QuiltSpecification {
when:
QuiltProduct product = makeProduct('a=b&c=d')
Map start_meta = product.meta
println("start_meta: ${start_meta}")

then:
start_meta != null
start_meta.size() == 4
start_meta.a == 'b'
product.addSessionMeta()

when:
product.addSessionMeta()
Map end_meta = product.meta

then:
end_meta != null
end_meta.size() == 7
end_meta.size() > 4
end_meta.a == 'b'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class QuiltPackageTest extends QuiltSpecification {
def qpkg = qpath.pkg()
Path outputFolder = pkg.packageDest()
Path readmeFile = outputFolder.resolve('README.md')
println("qpkg: ${qpkg} -> ${qpath.localPath()} == ${readmeFile}")

expect:
!qpath.isJustPackage()
Expand Down Expand Up @@ -193,18 +192,14 @@ class QuiltPackageTest extends QuiltSpecification {

void 'should fail pushing new files to read-only bucket '() {
given:
println("read-only-bucket:TEST_URL: ${READONLY_URL}")
def qout = factory.parseUri(READONLY_URL)
def opkg = qout.pkg()
opkg.install()
println("opkg: ${opkg} installed: ${opkg.isInstalled()}")
def outPath = Paths.get(opkg.packageDest().toString(), 'foo/bar.txt')
println("outPath: ${outPath}")
Files.writeString(outPath, "Time: ${timestamp}")
expect:
Files.exists(outPath)
when:
println('Pushing to read-only bucket')
opkg.push()
then:
thrown(RuntimeException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ class QuiltParserTest extends QuiltSpecification {
when:
String query = 'key=val1,val2&quay=vale1&quay=vale2'
Map<String,Object> result = QuiltParser.parseQuery(query)
println "QuiltParserTest[$query] -> ${result}"
String unparsed = QuiltParser.unparseQuery(result)

then:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ class QuiltNioTest extends QuiltSpecification {
void 'should create temp file and directory'() {
given:
Path base = Paths.get(new URI(PACKAGE_URL)).toAbsolutePath()
println "BASE: ${base}"

when:
Path t1 = Files.createTempDirectory(base, 'test')
Expand Down

0 comments on commit e01c083

Please sign in to comment.