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 compact custom-made Nextflow error report #19

Merged
merged 55 commits into from
Aug 22, 2021

Conversation

Cecilia-Sensalari
Copy link
Collaborator

@Cecilia-Sensalari Cecilia-Sensalari commented Jun 28, 2021

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
    image

  • 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
    image

*are considered ERROR lines those that contain the "ERROR" word when parsed.

cesen added 7 commits June 28, 2021 18:43
- 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?
@Cecilia-Sensalari Cecilia-Sensalari marked this pull request as draft July 6, 2021 10:12
cesen added 3 commits July 6, 2021 16:52
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.
Copy link
Contributor

@lohausr lohausr left a 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.

main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
doc/source/faqs.rst Outdated Show resolved Hide resolved
doc/source/faqs.rst Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
Cecilia-Sensalari and others added 16 commits August 9, 2021 13:02
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.
- 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
@Cecilia-Sensalari
Copy link
Collaborator Author

UPDATE:
About parsing in the error log the two species names in an interrupted wgdOrtholog process.
Each wgdOrthologs process now produces a file in its work directory storing the two names (work/xx/xxxxxxxx/species_names.tsv). Given that the errorReport shows the work directory of the interrupted process (see below), the code parses its path out of the errorReport and reads the species_names.tsv file herein.

  • The parsing of the path works this way: the code looks for the line containing "Work dir:" and then takes the successive line.

image

- 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
- 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
ksrates/fc_configfile.py Outdated Show resolved Hide resolved
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
main.nf Outdated Show resolved Hide resolved
main.nf Outdated Show resolved Hide resolved
ksrates/plot_paralogs.py Outdated Show resolved Hide resolved
ksrates/plot_paralogs.py Outdated Show resolved Hide resolved
ksrates/wgd_paralogs.py Outdated Show resolved Hide resolved
Co-authored-by: lohausr <56632794+lohausr@users.noreply.github.com>
Copy link
Contributor

@lohausr lohausr left a 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!

@Cecilia-Sensalari Cecilia-Sensalari marked this pull request as ready for review August 22, 2021 12:13
@Cecilia-Sensalari Cecilia-Sensalari merged commit ffe262f into master Aug 22, 2021
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

Successfully merging this pull request may close these issues.

2 participants