Skip to content

Add publishLogs directive to process #6341

@nickp60

Description

@nickp60

New feature

Hello! I am paranoid about losing logs used to generate results. I would love there to be an option to publish the logs for a given process that would transfer all the "*.conmand" files to a logs subdirectory in that task's publishDir.

Use case

Current options

To my knowledge, it seems like the current options for retaining logs include:

  • relying on tools built-in log files. These may or may not exists, and do not capture issues that occur before that tool's logging is instantiated (eg a permissions error, a singularity mount error, errors importing packages that occur at runtime, etc)
  • manually piping the logs within the process script. This is both verbose, flimsy, and requires foreknowledge of what tools output logs vs results to stderr, stdout. It also does not capture executor-level error (preemption, io errors, etc)
  • Manually transferring the actual logs from work/. This requires several calls to identify the hash of the task that succeeded, and has to be run after nextflow has finished.

Desired use case

Something like this, would default to false. Could even take a list of which logs would be include in case some are too verbose, but that might be unecessarily complicated

// split process
process split {
    publishLogs: true        #
    publishDir "results/lower"
    
    input:
    val x
    
    output:
    path 'chunk_*'

    script:
    """
    printf '${x}' | split -b 6 - chunk_
    """
}

would result in something like

.
└── split
    ├── chunk1
    └── logs
        ├── .command.begin
        ├── .command.err
        ├── .command.log
        ├── .command.out
        ├── .command.run
        ├── .command.sh
        ├── .command.trace
        └── .exitcode

Suggested implementation

I don't know enough groovy to really be helpful here, but perhaps it could be included in the publishDir class?
src/main/groovy/nextflow/processor/PublishDir.groovy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions