Skip to content

Commit

Permalink
Publish built-in reports only if specified in tower.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
  • Loading branch information
bentsherman committed Feb 23, 2024
1 parent e27fd41 commit a8607b5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ class TowerClient implements TraceObserver {
void onFlowComplete() {
// submit the record
events << new ProcessEvent(completed: true)
// send any runtime reports that are enabled
reports.sendRuntimeReports()
// 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 @@ -204,35 +204,6 @@ class TowerReports {
return false
}

/**
* Send any built-in reports that are enabled to the reports file.
*/
void sendRuntimeReports() {
final config = session.config
final Map<String,Map<String,String>> entries = [:]
if( config.navigate('report.enabled') ) {
final reportFile = config.navigate('report.file', ReportObserver.DEF_FILE_NAME) as String
entries[reportFile] = Map.of('display', 'Nextflow execution report')
}
if( config.navigate('timeline.enabled') ) {
final reportFile = config.navigate('timeline.file', TimelineObserver.DEF_FILE_NAME) as String
entries[reportFile] = Map.of('display', 'Nextflow timeline report')
}
if( config.navigate('trace.enabled') ) {
final reportFile = config.navigate('trace.file', TraceFileObserver.DEF_FILE_NAME) as String
entries[reportFile] = Map.of('display', 'Nextflow trace report')
}
if( config.navigate('dag.enabled') ) {
final reportFile = config.navigate('dag.file', GraphObserver.DEF_FILE_NAME) as String
entries[reportFile] = Map.of('display', 'Nextflow workflow diagram')
}

for( def entry : entries ) {
final destination = (entry.key as Path).complete()
writer.send((PrintWriter it) -> writeRecord(it, entry, destination))
}
}

private writeRecord(PrintWriter it, Map.Entry<String,Map<String,String>> reportEntry, Path destination) {
try {
final target = destination.toUriString()
Expand All @@ -253,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 a8607b5

Please sign in to comment.