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

Fix building Pipeline with YAML #800

Merged
merged 2 commits into from
Feb 4, 2021
Merged

Fix building Pipeline with YAML #800

merged 2 commits into from
Feb 4, 2021

Conversation

tanaysoni
Copy link
Contributor

@tanaysoni tanaysoni commented Feb 3, 2021

With #785, a feature to create a Pipeline from a YAML configuration file was introduced. It iteratively loads components as defined in the YAML.

To support the loading of the components, the BaseComponent class registers all subclasses using the __init_subclass__(). However, it may happen that a subclass is not yet evaluated by a Python interpreter, leading to a "component not found" error. The error did not get surfaced in the test cases as all the components used in the tests had already been imported and thus registered as subclasses of the BaseComponent.

This PR adds explicit import of components in their respective modules' __init__.py files.

Optionally, as a side benefit, it could simplify the import statements. For instance,

from haystack.document_store.elasticsearch import ElasticsearchDocumentStore

can be replaced with:

from haystack.document_store import ElasticsearchDocumentStore

@tanaysoni tanaysoni self-assigned this Feb 3, 2021
@tanaysoni tanaysoni changed the title WIP: Fix building Pipeline with YAML Fix building Pipeline with YAML Feb 3, 2021
@tanaysoni tanaysoni requested a review from tholor February 3, 2021 11:14
Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tanaysoni tanaysoni merged commit 7b18e32 into master Feb 4, 2021
@tanaysoni tanaysoni deleted the fix-component-init branch February 4, 2021 10:53
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.

None yet

2 participants