nextflow-io/nextflow

Adding a parameter for AnsiLogObserver delay

クローズ

#6,518 opened on 2025/10/28

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Groovy (784 件のフォーク)batch import
good first issue

Repository metrics

Stars
 (3,382 個のスター)
PR merge metrics
 (平均マージ 16d 9h) (30d で 54 merged PRs)

説明

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."
}

コントリビューターガイド