Skip to content

[gen_html robustness] exception of generating html data unhandled #413

@JizeZhangPsych

Description

@JizeZhangPsych

Source of Problem

in osl_ephys/source_recon/batch.py line 283-288, the following code is not wrapped within the try except block:

  • src_report.gen_html_page(reportdir)
  • src_report.gen_html_data(config, outdir, subject, reportdir, extra_funcs=extra_funcs)

if error thrown from these two functions, code could end unexpectedly.

Example of unexpected code ending

This is an example where this logic could lead to unexpected behaviour:

  1. In source recon step, the file lcmv-parc-raw.fif is generated, but code was stopped by OOM / segmentation fault / SIGINT / out of disk storage before the image freqbands.png could be generated;
  2. In the following sign flipping with another python file, when running gen_html_data, the key "parc_freqbands_plot" is within data.pkl (so line 117 is an True) but the png file is non-existing, leading to the following copying throwing an error at line 119 of osl-ephys/report/source_report.py

Solution to the problem:

Wrap osl_ephys/source_recon/batch.py line 285-288 within a new try-except block. It is not recommended to include it into the previous large try-except, as it's a html generation problem rather than failure of the pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions