-
Notifications
You must be signed in to change notification settings - Fork 9
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 compact custom-made Nextflow error report #19
Conversation
- There is now a customized error report when running the Nextflow pipeline and an error is encountered - After the default and long errorReport, it is also now shown a small error report through workflow.onError. - workflow.onError tells the user 1) the stopped process, 2) the error message lines and 3) the path to the log folder where to find the complete output of the process - Note: the shown error lines are those that contain the "ERROR" word when parsed.
- In case the log file of the stopped process doesn't exist or doesn't contain any ERROR line, catch the error from "Caused by:" errorReport lines and from errorMessage.
- If the log file exists AND if it contains ERROR lines, print the error lines - If any of the two conditions is not true, print the "Caused by:" line and the errorMessage
- The error box points to the process log file, which contains the complete output. However, when the process is "wgdOrthologs", workflow.onError doesn't know the name of the process log file because it depends on which two species were involved. - Therefore the code now obtaines the two names from parsing the errorMessage output lines and uses them to infer the filename, e.g. "wgd_orthologs_oryza_asparagus.log". - WIP: is it always possible to parse the names from the errorMessage lines?
Catches three cases: 1) process log file exists and contains ERROR lines: print lines and point to log file 2) process log file exists but no ERROR lines: the error was unexpected and just point to log file 3) process log file doesn't exist: print the errorReport "Caused by" line and the errorMessage, if any - To obtain the log filename of wgdOrtholog, parse the errorMessage, but only if it is not "null". If it is "null", the error cause is probably external to the pipeline itself (e.g. mis- communication with the cluster). In this case, the code follows case 3 above because the log filename is unknown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments and proposed changes.
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
- log_names dictionary is moved at the beginning of the Nextflow file. - Every log file name throughout the code is replaced by calling the dictionary - The wgdOrtholog's filename depends on the current species pair, so only the fixed part is kept in the dictionary.
- The behaviour of "log.error" in workflow.onError() has changed and now it add extra newlines... - To have back the normal error box, all log.error lines are removed and the text is accumulated in a long string, that is printed at the end. - Some variable renaming
- For each process name (available in dictionary) check if it has a match in the errorReport; - if so, that's the process that caused the crash; assign the process to the "process" variable.
…rates into nextflow_error_report
- Each wgdOrtholog process produces a file storing the two species names in the work directory of the process. - The error logger knows the work directory and the code accesses the two names from the file therein. - Avoid parsing species names from unstable output
UPDATE:
|
- First look for the line containing "Caused by:" in the errorReport - Get its index - Get the content of the successive line, which effectively contains the messsage
…rates into nextflow_error_report
- both in onError and onComplete
- both in onComplete and onError - onComplete will print that it can't delete possible leftovers in paralog_distrib. - onError will prints a message pointing to the log file without using the whole path
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
- If errorReport gives nothing useful, apply the same to errorMessage - If species names are still unknown, point to a generic wgd_ortholog_
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
…rates into nextflow_error_report
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems all good to me now, thx!
There is now a compact "error box" appearing at the end of the errorReport screen when the Nextflow pipeline crashes. It is implemented in workflow.onError in main.nf. It covers two cases:
In case the stopped process printed some ERROR lines* in its log file output, the error box tells the user 1) the name of the stopped process, 2) the error message lines and 3) the path to the log file where to find the complete output of the process
In case the stopped process didn't generate any log file or didn't print any ERROR lines* in its log file, the error is probably due to an external cause (e.g. comunication with the cluster) and the error box tells the user 1) the name of the stopped process, 2) the "Caused by:" line from Nextflow errorReport, 3) the errorMessage (if any) and 4) it points to the complete error report and to .nextflow.log
*are considered ERROR lines those that contain the "ERROR" word when parsed.