diff --git a/README.md b/README.md index 4680a238..80ab242b 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ keys to extract only the metadata you need, if present. For example: ```groovy quilt { meta = [pipeline: 'nf-core/rnaseq'] - msg = "${meta['config']['runName']}: ${meta['cmd']}" + msg = "${meta['config']?.get('runName')}: ${meta['cmd']}" readme = ''' # ${pkg} diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy index 47ace647..e6944b55 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy @@ -173,7 +173,9 @@ ${nextflow} } Map> cf = session.config println("addSessionMeta.cf: ${cf}") - Map qf = cf.navigate('quilt') as Map> + Map qf = cf.navigate('quilt') as Map + qf['package_id'] = pkg.toString() + qf['uri'] = path.toUriString() println("addSessionMeta.qf: ${qf}") Map cmeta = qf.navigate('meta') as Map println("addSessionMeta.cmeta: ${cmeta}") @@ -181,12 +183,13 @@ ${nextflow} try { Map smeta = getMetadata(cf) // println("addSessionMeta.smeta: ${smeta}") - smeta['quilt'] = [package_id: pkg.toString(), uri: path.toUriString()] - msg = "${smeta['config']['runName']}: ${smeta['cmd']}" + smeta['quilt'] = qf smeta.remove('config') meta += smeta + cmeta + msg = "${cf.get('runName')}: ${meta['cmd']}" } catch (Exception e) { - log.error("addSessionMeta.getMetadata failed: ${e.getMessage()}\n{$e}", pkg.meta) + println("addSessionMeta.getMetadata failed: $e") + log.error("addSessionMeta.getMetadata failed: ${e.getMessage()}", pkg.meta) return false } writeNextflowMetadata(meta, 'metadata') diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy index 500e15e2..0b0488c3 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy @@ -281,15 +281,15 @@ class QuiltPackage { }) } // https://docs.quiltdata.com/v/version-5.0.x/examples/gitlike#install-a-package - Manifest push(String msg = 'update', Map meta = [:]) { + Manifest push(String msg = 'update', Map meta = [:], String pkg = null) { if (isNull()) { log.debug('null bucket: no need to push') return null } - + String pkgName = pkg ?: packageName S3PhysicalKey registryPath = new S3PhysicalKey(bucket, '', null) Registry registry = new Registry(registryPath) - Namespace namespace = registry.getNamespace(packageName) + Namespace namespace = registry.getNamespace(pkgName) Manifest.Builder builder = Manifest.builder() @@ -309,10 +309,10 @@ class QuiltPackage { builder.setMetadata((ObjectNode)mapper.valueToTree(fullMeta)) Manifest m = builder.build() - log.debug("push[${this.parsed}]: ${m}") + log.debug("push[${pkgName}]: ${m}") try { Manifest manifest = m.push(namespace, "nf-quilt:${today()}-${msg}", parsed.workflowName) - log.debug("pushed[${this.parsed}]: ${manifest}") + log.debug("pushed[${pkgName}]: ${manifest}") return manifest } catch (Exception e) { log.error('ERROR: Failed to push manifest', e) diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy index a5fa21b3..5f4f0bd1 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy @@ -49,7 +49,7 @@ class QuiltProductTest extends QuiltSpecification { getWorkflowMetadata() >> wf_meta getParams() >> [outdir: url] isSuccess() >> success - config >> [quilt: [metadata: [cfkey: 'cfval']], runName: 'my-run', publishing: false] + config >> [quilt: [meta: [cfkey: 'cfval']], runName: 'my-run', publishing: false] } return new QuiltProduct(pathify, session) } @@ -187,7 +187,7 @@ class QuiltProductTest extends QuiltSpecification { } @Ignore('Not implemented yet: pushes previous metadata') - void 'pushes previous metadata if metadata=SKIP'() { + void 'pushes previous metadata if meta=SKIP'() { given: Map meta = [ 'Name': 'QuiltPackageTest', @@ -196,7 +196,7 @@ class QuiltProductTest extends QuiltSpecification { 'Type': 'NGS' ] Map bad_meta = meta + ['Type': 'Workflow'] - Map skip_meta = ['metadata': 'SKIP'] + Map skip_meta = ['meta': 'SKIP'] when: makeWriteProduct() // no metadata