Skip to content

Sphinx gallery scraper is not parallel-safe #4959

Open
@stefanv

Description

@stefanv

Sphinx Gallery now allows parallel execution of gallery examples. The plotly Orca renderer correctly outputs PNGs with the example filename as root, e.g., plot_my_example.png.

However, the scraper grabs all PNGs from the example directory. So, if other plotly examples execute simultaneously, those PNGs may be "stolen" by the scraper.

To fix the issue, the scraper would have to be modified from:

    examples_dir = os.path.dirname(block_vars["src_file"])
    pngs = sorted(glob(os.path.join(examples_dir, "*.png")))

to

    examples_dir = os.path.dirname(block_vars["src_file"])
    fn_root, _ = os.path.splitext(block_vars["src_file"])
    pngs = sorted(glob(os.path.join(examples_dir, f"{fn_root}_*.png")))

Note the more selective filter on the globbed PNGs.

Metadata

Metadata

Assignees

Labels

P2considered for next cyclebugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions