Skip to content

Commit

Permalink
Publish built-in reports as Tower reports (nextflow-io#4760)
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Niklas Schandry <niklas@bio.lmu.de>
  • Loading branch information
bentsherman authored and nschan committed Apr 3, 2024
1 parent d8959ed commit c3cfc49
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ class TowerClient implements TraceObserver {
void onFlowComplete() {
// submit the record
events << new ProcessEvent(completed: true)
// publish runtime reports
reports.publishRuntimeReports()
// wait the submission of pending events
sender.join()
// wait and flush reports content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import groovy.yaml.YamlSlurper
import groovyx.gpars.agent.Agent
import nextflow.Session
import nextflow.file.FileHelper
import nextflow.trace.GraphObserver
import nextflow.trace.ReportObserver
import nextflow.trace.TimelineObserver
import nextflow.trace.TraceFileObserver
/**
* If reports are defined at `nf-<workflow_id>-tower.yml`, collects all published files
* that are reports and writes `nf-<workflow_id>-reports.tsv` file with all the paths.
Expand Down Expand Up @@ -220,4 +224,27 @@ class TowerReports {
final prefix = reportKey.startsWith("**/") ? "" : "**/"
return "glob:${prefix}${reportKey}"
}

/**
* Publish any built-in reports that are enabled to the reports file.
*/
void publishRuntimeReports() {
final config = session.config
final files = []

if( config.navigate('report.enabled') )
files << config.navigate('report.file', ReportObserver.DEF_FILE_NAME)

if( config.navigate('timeline.enabled') )
files << config.navigate('timeline.file', TimelineObserver.DEF_FILE_NAME)

if( config.navigate('trace.enabled') )
files << config.navigate('trace.file', TraceFileObserver.DEF_FILE_NAME)

if( config.navigate('dag.enabled') )
files << config.navigate('dag.file', GraphObserver.DEF_FILE_NAME)

for( def file : files )
filePublish( (file as Path).complete() )
}
}

0 comments on commit c3cfc49

Please sign in to comment.