Skip to content

Commit

Permalink
Add executor display name rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pditommaso committed Apr 13, 2020
1 parent c2e0ac0 commit 74c90ca
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ class ExecutorFactory {
}
}

String getDisplayName(String key) {
final clazz = executorsMap.get(key)
if( !clazz ) return key
final exec = this.executors.get(clazz)
if( !exec ) return key
exec.getDisplayName() ?: key
}

/**
* Extract the executor name by using the annotation {@code ServiceName} or fallback to simple classname
* if the annotation is not provided
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@

package nextflow.trace

import static nextflow.util.LoggerHelper.*
import static org.fusesource.jansi.Ansi.*

import groovy.transform.CompileStatic
import jline.TerminalFactory
import nextflow.Session
import nextflow.processor.TaskHandler
import nextflow.util.Duration
import org.fusesource.jansi.Ansi
import org.fusesource.jansi.AnsiConsole
import static nextflow.util.LoggerHelper.isHashLogPrefix
import static org.fusesource.jansi.Ansi.Attribute
import static org.fusesource.jansi.Ansi.Color
import static org.fusesource.jansi.Ansi.ansi
/**
* Implements an observer which display workflow
* execution progress and notifications using
Expand Down Expand Up @@ -207,12 +208,16 @@ class AnsiLogObserver implements TraceObserver {
}
}

protected String getExecutorName(String key) {
session.getExecutorFactory().getDisplayName(key)
}

protected void renderExecutors(Ansi term) {
int count=0
def line = ''
for( Map.Entry<String,Integer> entry : executors ) {
if( count++ ) line += ","
line += " $entry.key ($entry.value)"
line += " ${getExecutorName(entry.key)} ($entry.value)"
}

if( count ) {
Expand Down

0 comments on commit 74c90ca

Please sign in to comment.