Commit e3b2ef3e authored by Celine Noirot's avatar Celine Noirot
Browse files

#2 add template name from variable

parent 9bacbc76
Pipeline #37609 failed with stage
in 17 seconds
......@@ -145,7 +145,7 @@ if (params.email || params.email_on_fail) {
summary['E-mail on failure'] = params.email_on_fail
}
log.info "-\033[2m--------------------------------------------------\033[0m-"
log.info "-\033[2m---------------- get-nf workflow -----------------\033[0m-"
log.info "-\033[2m----------------"+ workflow.manifest.name +" --\033[0m-"
log.info "-\033[2m--------------------------------------------------\033[0m-"
log.info summary.collect { k,v -> "${k.padRight(18)}: $v" }.join("\n")
log.info "-\033[2m--------------------------------------------------\033[0m-"
......@@ -302,9 +302,10 @@ process output_documentation {
workflow.onComplete {
// Set up the e-mail variables
def subject = "[get-nf/template] Successful: $workflow.runName"
def name_wf = workflow.manifest.name
def subject = "[$name_wf] Successful: $workflow.runName"
if (!workflow.success) {
subject = "[get-nf/template] FAILED: $workflow.runName"
subject = "[$name_wf] FAILED: $workflow.runName"
}
def email_fields = [:]
email_fields['version'] = workflow.manifest.version
......@@ -343,12 +344,12 @@ workflow.onComplete {
def tf = new File("$baseDir/assets/email_template.txt")
def txt_template = engine.createTemplate(tf).make(email_fields)
def email_txt = txt_template.toString()
// Send the HTML e-mail
if (email_address) {
// Catch failures and try with plaintext
[ 'mail', '-s', subject, email_address ].execute() << email_txt
log.info "[get-nf/template] Sent summary e-mail to $email_address (mail)"
log.info "[$name_wf] Sent summary e-mail to $email_address (mail)"
log.info "$email_txt"
}
......@@ -359,22 +360,20 @@ workflow.onComplete {
}
def output_tf = new File( output_d, "pipeline_report.txt" )
output_tf.withWriter { w -> w << email_txt }
c_reset = params.monochrome_logs ? '' : "\033[0m";
c_purple = params.monochrome_logs ? '' : "\033[0;35m";
c_green = params.monochrome_logs ? '' : "\033[0;32m";
c_purple = params.monochrome_logs ? '' : "\033[0;35m";
c_red = params.monochrome_logs ? '' : "\033[0;31m";
c_reset = params.monochrome_logs ? '' : "\033[0m";
if (workflow.stats.ignoredCount > 0 && workflow.success) {
log.info "${c_purple}Warning, pipeline completed, but with errored process(es) ${c_reset}"
log.info "${c_red}Number of ignored errored process(es) : ${workflow.stats.ignoredCount} ${c_reset}"
log.info "${c_green}Number of successfully ran process(es) : ${workflow.stats.succeedCount} ${c_reset}"
log.info "-${c_purple}Warning, pipeline completed, but with errored process(es) ${c_reset}"
log.info "-${c_red}Number of ignored errored process(es) : ${workflow.stats.ignoredCount} ${c_reset}"
log.info "-${c_green}Number of successfully ran process(es) : ${workflow.stats.succeedCount} ${c_reset}"
}
if (workflow.success) {
log.info "${c_purple}[get-nf/template]${c_green} Pipeline completed successfully${c_reset}"
log.info "-${c_purple}[${name_wf}]${c_green} Pipeline completed successfully${c_reset}"
} else {
log.info "${c_purple}[get-nf/template]${c_red} Pipeline completed with errors${c_reset}"
log.info "-${c_purple}[${name_wf}]${c_red} Pipeline completed with errors${c_reset}"
}
}
\ No newline at end of file
......@@ -55,6 +55,7 @@ profiles {
test { includeConfig 'conf/test.config' }
path { process.beforeScript = "export PATH=${params.globalPath}:$PATH" }
multipath { includeConfig 'conf/path.config' }
genotoul { includeConfig 'conf/genotoul.config' }
}
// Avoid this error:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment