Skip to content

Commit

Permalink
Fix To json errors (#260)
Browse files Browse the repository at this point in the history
Java has brain-dead JSON handling, and I didn't properly try/catch that
part...

---------

Co-authored-by: Dr. Ernie Prabhakar <[email protected]>
  • Loading branch information
drernie and drernie authored Nov 5, 2024
1 parent 81f4083 commit 6c4ce26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- Improve handling of dynamically-specified URIs
- Rewrite README.md, splitting out developer documentation to README_DEV.md

## [0.8.11] 2024-11-5 UNPUBLISHED

- Catch *all* toJson errors

## [0.8.10] 2024-11-4 UNPUBLISHED

- Ignore publish to 'home'
Expand Down
23 changes: 16 additions & 7 deletions plugins/nf-quilt/src/main/nextflow/quilt/QuiltProduct.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,12 @@ ${nextflow}

String writeNextflowMetadata(Map map, String suffix) {
String filename = "nf-quilt/${suffix}.json"
// log.debug("writeNextflowMetadata[$suffix]: ${filename}")
writeString(QuiltPackage.toJson(map), pkg, filename)
log.debug("writeNextflowMetadata[$suffix]: ${filename}")
try {
writeString(QuiltPackage.toJson(map), pkg, filename)
} catch (Exception e) {
log.error("writeNextflowMetadata.toJson failed: ${e.getMessage()}", map)
}
return filename
}

Expand All @@ -227,7 +231,7 @@ ${nextflow}
writeNextflowMetadata(params, 'params')
params.remove('genomes')
params.remove('test_data')
// printMap(params, 'params')
printMap(params, 'params')
}
Map wf = session.getWorkflowMetadata().toMap()
String start = wf['start']
Expand All @@ -241,7 +245,7 @@ ${nextflow}
wf.remove('complete')
wf.remove('workflowStats')
wf.remove('commandLine')
// printMap(wf, 'workflow')
printMap(wf, 'workflow')
log.info("\npublishing: ${wf['runName']}")
}

Expand All @@ -264,7 +268,7 @@ ${nextflow}
log.error("setupReadme failed: ${e.getMessage()}\n{$e}", pkg.meta)
}
if (text != null && text.length() > 0) {
//log.debug("setupReadme: ${text.length()} bytes")
log.debug("setupReadme: ${text.length()} bytes")
writeString(text, pkg, README_FILE)
}
return text
Expand Down Expand Up @@ -342,8 +346,13 @@ ${nextflow}
}
}

String qs_json = JsonOutput.toJson(quilt_summarize)
writeString(qs_json, pkg, SUMMARY_FILE)
try {
String qs_json = JsonOutput.toJson(quilt_summarize)
writeString(qs_json, pkg, SUMMARY_FILE)
}
catch (Exception e) {
log.error("setupSummarize.toJson failed: ${e.getMessage()}\n{$e}", SUMMARY_FILE)
}
return quilt_summarize
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class QuiltPackage {
List<String> entries = dict.collect { key, value ->
String prefix = JsonOutput.toJson(key)
String suffix = "toJson.error: ${value}"
// log.debug("QuiltPackage.toJson: ${prefix} [${suffix.length()}]")
log.debug("QuiltPackage.toJson: ${prefix} [${suffix.length()}]")
try {
suffix = JsonOutput.toJson(value)
}
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.10
Plugin-Version: 0.8.11
Plugin-Provider: Quilt Data
Plugin-Requires: >=22.10.6

0 comments on commit 6c4ce26

Please sign in to comment.