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

Template: add option to exclude email from pipeline template #3126

Merged
merged 3 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- handle template features with a yaml file ([#3108](https://github.com/nf-core/tools/pull/3108))
- add templatefeatures.yml to python package ([#3112](https://github.com/nf-core/tools/pull/3112))
- add option to exclude license from pipeline template ([#3125](https://github.com/nf-core/tools/pull/3125))
- add option to exclude email from pipeline template ([#3126](https://github.com/nf-core/tools/pull/3126))

### Linting

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset

{%- if email %}
[/assets/email*]
indent_size = unset
{%- endif %}

# ignore python and markdown
[*.{py,md}]
Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{%- if email %}
email_template.html
{%- endif %}
adaptivecard.json
slackreport.json
.nextflow*
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Results generated by MultiQC collate pipeline QC from supported tools e.g. FastQ

- `pipeline_info/`
- Reports generated by Nextflow: `execution_report.html`, `execution_timeline.html`, `execution_trace.txt` and `pipeline_dag.dot`/`pipeline_dag.svg`.
- Reports generated by the pipeline: `pipeline_report.html`, `pipeline_report.txt` and `software_versions.yml`. The `pipeline_report*` files will only be present if the `--email` / `--email_on_fail` parameter's are used when running the pipeline.
{% if email %}- Reports generated by the pipeline: `pipeline_report.html`, `pipeline_report.txt` and `software_versions.yml`. The `pipeline_report*` files will only be present if the `--email` / `--email_on_fail` parameter's are used when running the pipeline. {% endif %}
- Reformatted samplesheet files used as input to the pipeline: `samplesheet.valid.csv`.
- Parameters used by the pipeline run: `params.json`.

Expand Down
4 changes: 3 additions & 1 deletion nf_core/pipeline-template/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
include { {{ short_name|upper }} } from './workflows/{{ short_name }}'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'
{% if igenomes %}
{%- if igenomes %}
include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_{{ short_name }}_pipeline'

/*
Expand Down Expand Up @@ -95,9 +95,11 @@ workflow {
// SUBWORKFLOW: Run completion tasks
//
PIPELINE_COMPLETION (
{%- if email %}
params.email,
params.email_on_fail,
params.plaintext_email,
{%- endif %}
params.outdir,
params.monochrome_logs,
params.hook_url,
Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ params {
// Boilerplate options
outdir = null
publish_dir_mode = 'copy'
{%- if email %}
email = null
email_on_fail = null
plaintext_email = false
{%- endif %}
monochrome_logs = false
hook_url = null
help = false
Expand Down
8 changes: 4 additions & 4 deletions nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"format": "directory-path",
"description": "The output directory where the results will be saved. You have to use absolute paths to storage on Cloud infrastructure.",
"fa_icon": "fas fa-folder-open"
},
}{% if email %},
"email": {
"type": "string",
"description": "Email address for completion summary.",
"fa_icon": "fas fa-envelope",
"help_text": "Set this parameter to your e-mail address to get a summary e-mail with details of the run sent to you when the workflow exits. If set in your user config file (`~/.nextflow/config`) then you don't need to specify this on the command line for every run.",
"pattern": "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"
}{% if multiqc %},
}{% endif %}{% if multiqc %},
"multiqc_title": {
"type": "string",
"description": "MultiQC report title. Printed as page header, used for filename if not otherwise specified.",
Expand Down Expand Up @@ -189,7 +189,7 @@
"fa_icon": "fas fa-copy",
"enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"],
"hidden": true
},
},{% if email %}
"email_on_fail": {
"type": "string",
"description": "Email address for completion summary, only when pipeline fails.",
Expand All @@ -203,7 +203,7 @@
"description": "Send plain-text email instead of HTML.",
"fa_icon": "fas fa-remove-format",
"hidden": true
},
},{% endif %}
{%- if multiqc %}
"max_multiqc_email_size": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ include { UTILS_NFVALIDATION_PLUGIN } from '../../nf-core/utils_nfvalidation_plu
include { paramsSummaryMap } from 'plugin/nf-validation'
include { fromSamplesheet } from 'plugin/nf-validation'
include { UTILS_NEXTFLOW_PIPELINE } from '../../nf-core/utils_nextflow_pipeline'
{%- if email %}
include { completionEmail } from '../../nf-core/utils_nfcore_pipeline'
{%- endif %}
include { completionSummary } from '../../nf-core/utils_nfcore_pipeline'
include { dashedLine } from '../../nf-core/utils_nfcore_pipeline'
include { nfCoreLogo } from '../../nf-core/utils_nfcore_pipeline'
Expand Down Expand Up @@ -117,9 +119,11 @@ workflow PIPELINE_INITIALISATION {
workflow PIPELINE_COMPLETION {

take:
{%- if email %}
email // string: email address
email_on_fail // string: email address sent on pipeline failure
plaintext_email // boolean: Send plain-text email instead of HTML
{% endif %}
outdir // path: Path to output directory where results will be published
monochrome_logs // boolean: Disable ANSI colour codes in log output
hook_url // string: hook URL for notifications
Expand All @@ -133,13 +137,15 @@ workflow PIPELINE_COMPLETION {
// Completion email and summary
//
workflow.onComplete {
{%- if email %}
if (email || email_on_fail) {
{%- if multiqc %}
completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, multiqc_report.toList())
{%- else %}
completionEmail(summary_params, email, email_on_fail, plaintext_email, outdir, monochrome_logs, [])
{%- endif %}
}
{%- endif %}

completionSummary(monochrome_logs)

Expand Down
18 changes: 18 additions & 0 deletions nf_core/pipelines/create/templatefeatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -257,3 +257,21 @@ license:
- "LICENSE"
nfcore_pipelines: False
custom_pipelines: True
email:
skippable_paths:
- "assets/email_template.html"
- "assets/sendmail_template.txt"
- "assets/email_template.txt"
short_description: "Enable email updates"
description: "Enable sending emails on pipeline completion."
help_text: |
Enable the option of sending an email which will include pipeline execution reports on pipeline completion.
linting:
files_exist:
- "assets/email_template.html"
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
- "assets/sendmail_template.txt"
- "assets/email_template.txt"
files_unchanged:
- ".prettierignore"
nfcore_pipelines: False
custom_pipelines: True
Loading
Loading