Skip to content

Unify loader instantiation

This unifies and centralizes the instantiation the same way the lister does.

This introduces a new base class swh.loader.core.loader.Loader for all loaders whose only concern for now is to instantiate loaders from either a configuration dict or a configuration file.

This simplify instantiation in celery task code and avoids duplicating the configuration load in each loader constructor.

The end goal is to simplify the future refactoring on configuration. With the following, we will only have to adapt the Loader class when we finally start simplifying uniformly the configuration.

Also note that I mostly reused the equivalent swh.lister.pattern.Lister.from_config*. I did not refactor the common behavior (to avoid throwing another dependency in the mix). That could always be refactored later.

Unfortunately the diff is a "tag" big but we can't really work around it...

(inspired by both the work on listers and the configuration system work)

Impacts:

Related to swh-core#1410


Migrated from D5071 (view on Phabricator)

Merge request reports