From 96cd4399b22a68dcf8c16eff3a7a80d6d7a41691 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Wed, 24 Jul 2024 18:47:19 +0200 Subject: [PATCH 1/6] throw exception to avoid hanging of workflow --- modules/local/seqera_runs_dump/functions.nf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/local/seqera_runs_dump/functions.nf b/modules/local/seqera_runs_dump/functions.nf index 038cb7c..92264bb 100644 --- a/modules/local/seqera_runs_dump/functions.nf +++ b/modules/local/seqera_runs_dump/functions.nf @@ -1,6 +1,7 @@ @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2;transitive=false') import wslite.rest.RESTClient import groovy.json.JsonSlurper +import nextflow.exception.ProcessException // Set system properties for custom Java trustStore def setTrustStore(trustStorePath, trustStorePassword) { @@ -48,6 +49,8 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) def workflowResponse = client.get(path: "/workflow/${runId}", query: ["workspaceId":workspaceId], headers: authHeader) if (workflowResponse.statusCode == 200) { metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName") + // log.warn("config: ${workflowResponse?.json?.workflow?.configText}") + // TODO: What is different to the viralrecon config config = new ConfigSlurper().parse( workflowResponse?.json?.workflow?.configText ) metaMap.fusion = config.fusion.enabled @@ -59,13 +62,14 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) Could not get workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ Status code ${ex.response?.statusCode} returned from request to ${ex.request?.url} (authentication headers excluded) """.stripIndent() - log.error "Exception: ${ex.message}", ex + throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) } catch (Exception ex) { log.warn """ An error occurred while getting workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ ${ex.message} """.stripIndent() - log.error "Exception: ${ex.message}", ex + throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) + } return [:] } From 36499f3ed0f58404be9b57dff2771fef8ee62d23 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Thu, 25 Jul 2024 10:23:55 +0200 Subject: [PATCH 2/6] throw exception instead of logging it --- modules/local/seqera_runs_dump/functions.nf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/local/seqera_runs_dump/functions.nf b/modules/local/seqera_runs_dump/functions.nf index 92264bb..17dbd16 100644 --- a/modules/local/seqera_runs_dump/functions.nf +++ b/modules/local/seqera_runs_dump/functions.nf @@ -1,7 +1,7 @@ @Grab('com.github.groovy-wslite:groovy-wslite:1.1.2;transitive=false') import wslite.rest.RESTClient import groovy.json.JsonSlurper -import nextflow.exception.ProcessException +import nextflow.exception.ProcessException // Set system properties for custom Java trustStore def setTrustStore(trustStorePath, trustStorePassword) { @@ -49,8 +49,6 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) def workflowResponse = client.get(path: "/workflow/${runId}", query: ["workspaceId":workspaceId], headers: authHeader) if (workflowResponse.statusCode == 200) { metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName") - // log.warn("config: ${workflowResponse?.json?.workflow?.configText}") - // TODO: What is different to the viralrecon config config = new ConfigSlurper().parse( workflowResponse?.json?.workflow?.configText ) metaMap.fusion = config.fusion.enabled From d3ea81cbeef4d1164dd4b284f1fbfce744121057 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Thu, 25 Jul 2024 10:24:25 +0200 Subject: [PATCH 3/6] also keep log --- modules/local/seqera_runs_dump/functions.nf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/local/seqera_runs_dump/functions.nf b/modules/local/seqera_runs_dump/functions.nf index 17dbd16..c489b4a 100644 --- a/modules/local/seqera_runs_dump/functions.nf +++ b/modules/local/seqera_runs_dump/functions.nf @@ -60,12 +60,14 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) Could not get workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ Status code ${ex.response?.statusCode} returned from request to ${ex.request?.url} (authentication headers excluded) """.stripIndent() + log.error(ex) throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) } catch (Exception ex) { log.warn """ An error occurred while getting workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ ${ex.message} """.stripIndent() + log.error(ex) throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) } From 1248bbb2fb18add47290fb02e9fb55623c0741b8 Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Thu, 25 Jul 2024 10:44:45 +0200 Subject: [PATCH 4/6] keep previous logging message --- modules/local/seqera_runs_dump/functions.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/local/seqera_runs_dump/functions.nf b/modules/local/seqera_runs_dump/functions.nf index c489b4a..bc2a5a7 100644 --- a/modules/local/seqera_runs_dump/functions.nf +++ b/modules/local/seqera_runs_dump/functions.nf @@ -60,14 +60,14 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) Could not get workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ Status code ${ex.response?.statusCode} returned from request to ${ex.request?.url} (authentication headers excluded) """.stripIndent() - log.error(ex) + log.error "Exception: ${ex.message}", ex throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) } catch (Exception ex) { log.warn """ An error occurred while getting workflow details for workflow ${runId} in workspace ${meta.workspace}: ↳ ${ex.message} """.stripIndent() - log.error(ex) + log.error "Exception: ${ex.message}", ex throw new ProcessException("Failed to get workflow details for workflow ${runId} in workspace ${meta.workspace}", ex) } From 3b2256485c973d6249c477f4e4b9c5c04339499c Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Wed, 24 Jul 2024 17:19:45 +0200 Subject: [PATCH 5/6] keep scope of linked map local --- modules/local/seqera_runs_dump/functions.nf | 4 ++-- workflows/nf_aggregate/main.nf | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/local/seqera_runs_dump/functions.nf b/modules/local/seqera_runs_dump/functions.nf index bc2a5a7..b08db2f 100644 --- a/modules/local/seqera_runs_dump/functions.nf +++ b/modules/local/seqera_runs_dump/functions.nf @@ -48,8 +48,8 @@ Map getRunMetadata(meta, log, api_endpoint, trustStorePath, trustStorePassword) if (workspaceId) { def workflowResponse = client.get(path: "/workflow/${runId}", query: ["workspaceId":workspaceId], headers: authHeader) if (workflowResponse.statusCode == 200) { - metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName") - config = new ConfigSlurper().parse( workflowResponse?.json?.workflow?.configText ) + def metaMap = workflowResponse?.json?.workflow?.subMap("runName", "workDir", "projectName") + def config = new ConfigSlurper().parse( workflowResponse?.json?.workflow?.configText ) metaMap.fusion = config.fusion.enabled return metaMap ?: [:] diff --git a/workflows/nf_aggregate/main.nf b/workflows/nf_aggregate/main.nf index c30f3c3..0296708 100644 --- a/workflows/nf_aggregate/main.nf +++ b/workflows/nf_aggregate/main.nf @@ -21,7 +21,7 @@ workflow NF_AGGREGATE { skip_multiqc // val: Skip MultiQC java_truststore_path // val: Path to java truststore if using private certs java_truststore_password // val: Password for java truststore if using private certs - + main: ch_versions = Channel.empty() @@ -30,6 +30,7 @@ workflow NF_AGGREGATE { // // MODULE: Fetch run information via the Seqera CLI // + SEQERA_RUNS_DUMP ( ids, seqera_api_endpoint, From b75d3582b460eeb077a007955c782e96b79e561d Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Thu, 25 Jul 2024 10:21:31 +0200 Subject: [PATCH 6/6] update snapshot --- modules/local/seqera_runs_dump/tests/main.nf.test.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/local/seqera_runs_dump/tests/main.nf.test.snap b/modules/local/seqera_runs_dump/tests/main.nf.test.snap index c55f5c2..442fb9b 100644 --- a/modules/local/seqera_runs_dump/tests/main.nf.test.snap +++ b/modules/local/seqera_runs_dump/tests/main.nf.test.snap @@ -2,7 +2,7 @@ "Should run without failures": { "content": [ [ - "service-info.json:md5,108f149aafa287bb56d715c0c7ee0359", + "service-info.json:md5,72586e82ad2064d1a90008c7956d80d8", "workflow-load.json:md5,4f02d5a24ab89aa648cd4346785c8f2c", "workflow-metadata.json:md5,b37b4faeddf283a2c44cbe4000e4ab6e", "workflow-metrics.json:md5,13a5b5d7447fad4a8baa053d1abf85e5", @@ -13,8 +13,8 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "24.04.2" }, - "timestamp": "2024-05-20T15:32:40.565622058" + "timestamp": "2024-07-25T10:21:06.447483" } } \ No newline at end of file