nextflow-io/nextflow

Adding a parameter for AnsiLogObserver delay

Open

#6,518 opened on Oct 28, 2025

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Groovy (3,382 stars) (784 forks)batch import
good first issue

Description

New feature

In AnsiLogObserver, we have the following render function:

protected void render0(dummy) {
        while(!stopped) {
            if( hasProgressChanges() )
                renderProgress(statsObserver.quickStats)
            synchronized (this) {
                wait(200)
            }
        }
        //
        final stats = statsObserver.getStats()
        renderProgress(stats)
        renderSummary(stats)
    }

However, for long pipelines with multiple jobs, having a 200 milliseconds delay is not always practical and simply increases the log file size.

Use case

Having a configurable delay could be useful to reduce and simplify the log file. For a pipeline where jobs / tasks last tens of seconds or even minutes, polling every 1-5 seconds would be better than every 1/5 second. Memory usage gain will be however negligible.

Suggested implementation

This delay could either be set in an environment variable, or be picked up through a config file :

String intervalStr = System.getenv("NXF_ANSILOG_WAIT_INTERVAL_MS") ?: "200" 
long waitInterval = 200
try {
    waitInterval = intervalStr.toLong()
} catch (NumberFormatException e) {
    log.warn "Invalid value for NXF_ANSILOG_WAIT_INTERVAL_MS: $intervalStr. Using default 200ms."
}

Contributor guide

Adding a parameter for AnsiLogObserver delay · nextflow-io/nextflow#6518 | Good First Issue