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

fix: check if fusion is enabled via the Platform API #57

Merged
merged 3 commits into from
Jul 26, 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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [[0.4.0](https://github.com/seqeralabs/nf-aggregate/releases/tag/0.4.0)] - 2024-07-26

### Credits

Special thanks to the following for their contributions to the release:

- [Friederike Hanssen](https://github.com/FriederikeHanssen)

Thank you to everyone else that has contributed by reporting bugs, enhancements or in any other way, shape or form.

### Enhancements & fixes

[PR #52](https://github.com/seqeralabs/nf-aggregate/pull/52) - Organise results folder structure by pipeline
[PR #53](https://github.com/seqeralabs/nf-aggregate/pull/53) - Throw exception and terminate workflow in case config can't be read
[PR #57](https://github.com/seqeralabs/nf-aggregate/pull/57) - Check if fusion is enabled via the Platform API

## [[0.3.0](https://github.com/seqeralabs/nf-aggregate/releases/tag/0.3.0)] - 2024-07-01

### Credits
Expand Down
7 changes: 5 additions & 2 deletions modules/local/seqera_runs_dump/functions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import wslite.rest.RESTClient
import groovy.json.JsonSlurper
import nextflow.exception.ProcessException
import groovy.json.JsonBuilder

// Set system properties for custom Java trustStore
def setTrustStore(trustStorePath, trustStorePassword) {
Expand Down Expand Up @@ -49,8 +50,10 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword)
def workflowResponse = client.get(path: "/workflow/${runId}", query: ["workspaceId":workspaceId], headers: authHeader)
if (workflowResponse.statusCode == 200) {
def metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName")
def config = new ConfigSlurper().parse( workflowResponse?.json?.workflow?.configText )
Copy link
Member Author

@drpatelh drpatelh Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line fails to load in the config just for viralrecon but works for other pipelines.

A quick way to reproduce would be to download the raw functions.nf and append the lines below at the end of the file. This would assume you have access to the workspaces below via exporting TOWER_ACCESS_TOKEN for Seqera Cloud.

def meta = [id:'LanYfJk1vaHuD', workspace:'scidev/azure']         // WORKS: no fusion   / nf-core/rnaseq
// def meta = [id:'3Z627eCb3HqUy3', workspace:'seqeralabs/showcase'] // WORKS: with fusion / nf-core/rnaseq
// def meta = [id:'13gHs3OF4AYPI5', workspace:'scidev/azure']        // FAILS: no fusion   / nf-core/viralrecon
def api_endpoint = 'https://api.cloud.seqera.io/'
def java_truststore_path = ''
def java_truststore_password = ''
metaOut = getRunMetadata(meta, log, api_endpoint, java_truststore_path, java_truststore_password)
println(metaOut)

You can then run the file directly as a Nextflow script to test:

nextflow run functions.nf

The fix in this PR is much more fragile because we are unable to load the config into a map and then checking whether Fusion is enabled. Instead, we are using a regex to check whether fusion is enabled via a pattern match in the config string.

This isn't a great solution but we can't think of anything more robust right now and can make improvements in the future.

metaMap.fusion = config.fusion.enabled
def configText = new JsonBuilder(workflowResponse?.json?.workflow?.configText)
def pattern = /fusion\s*\{\\n\s*enabled\s*=\s*true/
def matcher = configText.toPrettyString() =~ pattern
metaMap.fusion = matcher.find()

return metaMap ?: [:]
}
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,6 @@ manifest {
mainScript = 'main.nf'
nextflowVersion = '!>=23.10.0'
defaultBranch = 'main'
version = '0.3.0'
version = '0.4.0'
doi = ''
}
Loading