Skip to content

Tolerate errors in loading unused plugins #88

@jlumpe

Description

@jlumpe

In general I don't think that errors in loading plugins should prevent Snakemake from executing if that plugin is not used.

I think a good alternative would be to catch general exceptions in plugin code during registration (such as when importing the plugin module), log a warning instead, and store the information that loading the plugin failed. Then if the plugin is actually used Snakemake could fail with an informative error message (possibly printing the original stack trace).

Note that this would probably require special error handling around CLI option parsing - if plugin-specific options are specified, e.g. snakemake --logger mylogger --logger-mylogger-option foo, and an error occurred in loading the mylogger plugin, its settings won't be registered and the --logger-mylogger-option option won't be recognized. This will raise an exception before --logger mylogger is even processed. It should be easy to catch the error, figure out the registry and plugin name, and display the plugin load error if it exists.

I'd be happy to contribute a PR for this.

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