Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

258 handle null configs #259

Merged
merged 4 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
- Improve handling of dynamically-specified URIs
- Rewrite README.md, splitting out developer documentation to README_DEV.md

## [0.8.10] 2024-11-4 UNPUBLISHED

- Ignore publish to 'home'
- Fix: Cannot set property 'package_id' on null object

## [0.8.9] 2024-10-31 UNPUBLISHED

- Handle multiple/internal publishDir calls
Expand Down
5 changes: 5 additions & 0 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltPathify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ class QuiltPathify {
}

boolean isBucketAccessible() {
// ignore internal publishing from work dir
if (path.getBucket() == 'home') {
log.warn('isBucketAccessible: ignoring `home` bucket')
return false
}
return pkg.isBucketAccessible()
}

Expand Down
8 changes: 7 additions & 1 deletion plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,18 @@ ${nextflow}
}

boolean addSessionMeta() {
println("addSessionMeta: ${session}")
if (shouldSkip(KEY_META)) {
return false
}

Map<String, Map<String,Object>> cf = session.config
println("addSessionMeta.cf: ${cf}")
Map qf = cf.navigate('quilt') as Map<String, Object>
if (cf == null) {
log.error('addSessionMeta: no config found', pkg.meta)
return false
}
Map<String, Object> qf = cf.navigate('quilt') as Map<String, Object> ?: [:]
qf['package_id'] = pkg.toString()
qf['uri'] = path.toUriString()
println("addSessionMeta.qf: ${qf}")
Expand Down
2 changes: 1 addition & 1 deletion plugins/nf-quilt/src/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Plugin-Class: nextflow.quilt.QuiltPlugin
Plugin-Id: nf-quilt
Plugin-Version: 0.8.9
Plugin-Version: 0.8.10
Plugin-Provider: Quilt Data
Plugin-Requires: >=22.10.6
26 changes: 24 additions & 2 deletions plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ class QuiltProductTest extends QuiltSpecification {
return makeProductFromUrl(subURL, success)
}

QuiltProduct makeConfigProduct(Map config = null) {
QuiltPath path = QuiltPathFactory.parse(testURI)
QuiltPathify pathify = new QuiltPathify(path)
Session session = GroovyMock(Session)
session.config >> config
QuiltProduct product = new QuiltProduct(pathify, session)
return product
}

QuiltProduct makeWriteProduct(Map meta = [:]) {
String subURL = writeableURI('quilt_product_test') // + '&workflow=universal'
if (meta) {
Expand Down Expand Up @@ -117,6 +126,19 @@ class QuiltProductTest extends QuiltSpecification {
!makeProduct('?readme=now').shouldSkip()
}

void 'addSessionMeta is false if no config'() {
when:
QuiltProduct no_config = makeConfigProduct()
then:
no_config.addSessionMeta() == false

when:
QuiltProduct no_quilt = makeConfigProduct([quilt: null])

then:
no_quilt.addSessionMeta() == false
}

@IgnoreIf({ System.getProperty('os.name').toLowerCase().contains('windows') })
void 'does not create README if readme=SKIP'() {
given:
Expand All @@ -137,7 +159,7 @@ class QuiltProductTest extends QuiltSpecification {

then:
!defaultREADME.shouldSkip(QuiltProduct.KEY_README)
files.size() == 1
files.size() > 0

when:
String readme_text = 'hasREADME'
Expand All @@ -147,7 +169,7 @@ class QuiltProductTest extends QuiltSpecification {
then:
text == readme_text
!hasREADME.shouldSkip(QuiltProduct.KEY_README)
files.size() == 1
files.size() > 0
}

void 'setupSummarize empty if no files are present'() {
Expand Down
Loading