Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add access to workflow metadata and runtime information #79

Closed
mfoll opened this issue Oct 6, 2015 · 6 comments
Closed

Add access to workflow metadata and runtime information #79

mfoll opened this issue Oct 6, 2015 · 6 comments
Milestone

Comments

@mfoll
Copy link

mfoll commented Oct 6, 2015

It would be interesting for reproducibility to have access to more environment variables to be able to write them in the output created during the pipeline. I can think for example of:

  • repository (github, gitlab...)
  • pipeline version (commit number and tag/version)
  • the full command line used like written in .nextflow.log
  • the docker image when provided using nextflow run -with-docker

Currently only nextflow version number is accessible with $NXF_VER (see here).

@pditommaso pditommaso added this to the v0.16.0 milestone Oct 14, 2015
@pditommaso
Copy link
Member

I'm proposing to add these properties in the main script scope

workflow.repository     // clone url of the project repository
workflow.commitId       // commit of the project repository
workflow.revision       // tag.branch of the project repository
workflow.startTime      // start execution timestamp 
workflow.endTime        // end execution timestamp
workflow.duration       // how long it take to run
workflow.container      // Docker image when available
workflow.commandLine    // execution command line
workflow.nextflow.version    // nextflow version number

workflow.onComplete { <do something> }

The last one is ah event handler that would allow to take an action when the pipeline execution complete e.g. send a notification, write the workflow metadata, etc.

@mfoll
Copy link
Author

mfoll commented Oct 15, 2015

It seems perfect to me. For the Docker image you will only put it there when it's a single global image (-with-dockeroption), and we can refer to the trace file when they are process-specific?

@pditommaso
Copy link
Member

An alternative, when more than a container is used, could be to have the container property to return a map of pairs process name: container name.

What do you think?

@mfoll
Copy link
Author

mfoll commented Oct 15, 2015

Yes that would be even better if you can do that!

@pditommaso
Copy link
Member

OK, I've just uploaded a new snapshot implementing that. You can download it running:

NXF_VER=0.16.0-SNAPSHOT CAPSULE_RESET=1 nextflow info 

Bonus: the onComplete event handler can be defined also in the config file, but in this case it needs to defined using the assignment operator. For example:

workflow.onComplete = {
  println "DONE!"
  println "Info: $workflow"
}

pditommaso added a commit that referenced this issue Oct 15, 2015
pditommaso added a commit that referenced this issue Oct 16, 2015
pditommaso added a commit that referenced this issue Oct 18, 2015
@pditommaso pditommaso changed the title Add access to more environment variables like $NXF_VER in nf script Add access to workflow metadata and runtime information Oct 23, 2015
@pditommaso
Copy link
Member

See the related documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants