nextflow-io / nextflow-io/nextflow

Provide a unified start timestamp for scripts and config files

Open
#5,244 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Groovy
Stars
3.5k
Forks
811
Avg merge
2d 11h
Merged PRs (30d)
61

Description

The nf-core pipeline template uses a custom timestamp in the various report file names:

def trace_timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss')
timeline {
    enabled = true
    file    = "${params.outdir}/pipeline_info/execution_timeline_${trace_timestamp}.html"
}
report {
    enabled = true
    file    = "${params.outdir}/pipeline_info/execution_report_${trace_timestamp}.html"
}
// ...

This is problematic because the new config parser does not support top-level variable declarations like this.

The quick solution is to copy the timestamp expression into each report filename. But then there is a small chance that some report filenames might differ by one second since the timestamp is computed multiple times.

The deeper problem I think is that there is not a single start timestamp that can be used across all scripts and configs.

There is workflow.start: https://github.com/nextflow-io/nextflow/blob/12ea4d7c1d9b35d0fc0a8a57836cb33649339b6d/modules/nextflow/src/main/groovy/nextflow/script/WorkflowMetadata.groovy#L256

But the default report file names use a different timestamp: https://github.com/nextflow-io/nextflow/blob/12ea4d7c1d9b35d0fc0a8a57836cb33649339b6d/modules/nextflow/src/main/groovy/nextflow/trace/ReportObserver.groovy#L43

It should be possible to define a single timestamp that can be exposed to config files and also used by workflow.start. It would be another implicit config variable such as launchTime.

We could also try to expose the entire workflow variable, but it isn't resolved until later on, so we would have to do some config parser magic to lazy-evaluate expressions that use the workflow variable.

cc @ewels @pditommaso for your four cents

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading WorkflowMetadata.groovy, ReportObserver.groovy, the new config parser, and the implicit config variable documentation linked in the issue. Trace when the start time is created and how config expressions are resolved; done means one timestamp is consistently available to scripts and configs, used by workflow.start, and reflected in report filenames.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.