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

Support pipeline factory functions as CLI reference #699

Merged
merged 3 commits into from
Dec 6, 2023

Conversation

RobbeSneyders
Copy link
Member

In our RAG use case, we want to start using a pipeline factory function, but this is currently not supported by the CLI.

This PR fixes that.

I also included a change (the first commit) which removes the finally blocks. We were using this as follows:

try:
    ref = ...
except SpecificError:
    ref = ...
finally:
    run(ref)

But apparently the finally block is also entered if any non-SpecificError exception is raised in the try block. This lead to all non-handled errors to become an UnboundLocal error. This is now no longer the case, and the original error is not caught.

@GeorgesLorre
Copy link
Collaborator

But apparently the finally block is also entered if any non-SpecificError exception is raised in the try block. This lead to all non-handled errors to become an UnboundLocal error. This is now no longer the case, and the original error is not caught.

TIL

@GeorgesLorre
Copy link
Collaborator

I'm going to review this tomorrow after a nights sleep 😉

Copy link
Collaborator

@GeorgesLorre GeorgesLorre left a comment

Choose a reason for hiding this comment

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

Cool! Going to open a lot op possibilities

# Attribute is not a valid python name
"examples.example_modules.pipeline:pipe;line",
# Not a Pipeline
"examples.example_modules.pipeline:number",
],
)
def test_pipeline_from_module_error(module_str):
"""Test different error cases for pipeline_from_string."""
with pytest.raises(PipelineImportError):
Copy link
Collaborator

Choose a reason for hiding this comment

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

can't you match the error messages here ? with pytest match

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 be possible, but I didn't think it was worth the effort. Prioritizing some other work at the moment :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok to merge this then if it blocking

@RobbeSneyders RobbeSneyders merged commit 7b6c9c5 into main Dec 6, 2023
6 checks passed
@RobbeSneyders RobbeSneyders deleted the feature/pipeline-factory branch December 6, 2023 08:16
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.

2 participants