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

chore: Simplify Pipeline.run method by moving code to the base class #7680

Merged
merged 8 commits into from May 14, 2024

Conversation

masci
Copy link
Member

@masci masci commented May 10, 2024

Proposed Changes:

This PR has the only purpose to clean up the logic of the run method by moving code around, no functional changes.
It should also make the code more testable, but knowing we have #7611 pending, I'm not touching them.
There's more code to move, but I want to keep the diff small to speed up the review process.

How did you test it?

Existing tests

Notes for the reviewer

Checklist

@masci masci requested a review from silvanocerza May 10, 2024 11:51
@masci masci requested a review from a team as a code owner May 10, 2024 11:51
@masci masci requested review from julian-risch and removed request for a team and julian-risch May 10, 2024 11:51
# TODO: Support also this format:
# data = {
# "input1": 1, "input2": 2,
# }
Copy link
Member Author

Choose a reason for hiding this comment

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

This comment was outdated

# This implementation of run supports only the first format, but the second format is actually
# never received by this method. It's handled by the `run()` method of the `Pipeline` class
# defined in `haystack/pipeline.py`.
# As of now we're ok with this, but we'll need to merge those two classes at some point.
Copy link
Member Author

Choose a reason for hiding this comment

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

This comment was outdated

pipe.connect("greet", "adder")
pipe._init_graph()
for node in pipe.graph.nodes:
assert pipe.graph.nodes[node]["visits"] == 0
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I do the same for the newly added private methods?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that would be cool.

@masci masci added the ignore-for-release-notes PRs with this flag won't be included in the release notes. label May 10, 2024
@coveralls
Copy link
Collaborator

coveralls commented May 10, 2024

Pull Request Test Coverage Report for Build 9086069754

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 48 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.05%) to 90.46%

Files with Coverage Reduction New Missed Lines %
core/pipeline/pipeline.py 3 98.01%
components/fetchers/link_content.py 5 78.31%
core/pipeline/base.py 16 92.72%
components/extractors/named_entity_extractor.py 24 68.67%
Totals Coverage Status
Change from base Build 9030307905: 0.05%
Covered Lines: 6552
Relevant Lines: 7243

💛 - Coveralls

Copy link
Contributor

@silvanocerza silvanocerza left a comment

Choose a reason for hiding this comment

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

I added the tests, approving and merging. 🤝

@silvanocerza silvanocerza merged commit cc1d4b1 into main May 14, 2024
22 checks passed
@silvanocerza silvanocerza deleted the massi/simplify-run branch May 14, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-for-release-notes PRs with this flag won't be included in the release notes. topic:core topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants