From a6b5a826e4ef9cdf2c224822c699c6d330988992 Mon Sep 17 00:00:00 2001 From: Sebastian Willenbrink Date: Thu, 2 Jan 2025 17:31:21 +0100 Subject: [PATCH] Address type issues and documentation Python doesn't support variable shadowing. Oops --- haystack/core/pipeline/base.py | 10 ++++------ haystack/core/pipeline/pipeline.py | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/haystack/core/pipeline/base.py b/haystack/core/pipeline/base.py index b9708ff950..c5dc4fda85 100644 --- a/haystack/core/pipeline/base.py +++ b/haystack/core/pipeline/base.py @@ -943,7 +943,7 @@ def _find_next_runnable_component( :param components_inputs: The current state of the inputs divided by Component name :param waiting_queue: Queue of Components waiting for input - :returns: The name and the instance of the next Component that can be run + :returns: None or the name and the instance of the next Component that can be run """ def count_inputs(name, comp): @@ -962,14 +962,12 @@ def count_inputs(name, comp): num_inputs += 1 return num_inputs - waiting_queue = [ - (name, comp, _is_lazy_variadic(comp), count_inputs(name, comp)) for name, comp in waiting_queue - ] + queue = [(name, comp, _is_lazy_variadic(comp), count_inputs(name, comp)) for name, comp in waiting_queue] first_runnable = next( ( (name, comp) - for (name, comp, lazy_variadic, num_inputs) in waiting_queue + for (name, comp, lazy_variadic, num_inputs) in queue if not lazy_variadic and num_inputs is not None and num_inputs > 0 ), None, @@ -980,7 +978,7 @@ def count_inputs(name, comp): first_lazy_variadic = next( ( (name, comp) - for (name, comp, lazy_variadic, num_inputs) in waiting_queue + for (name, comp, lazy_variadic, num_inputs) in queue if lazy_variadic and num_inputs is not None and num_inputs > 0 ), None, diff --git a/haystack/core/pipeline/pipeline.py b/haystack/core/pipeline/pipeline.py index 5457459fbc..2d18eae269 100644 --- a/haystack/core/pipeline/pipeline.py +++ b/haystack/core/pipeline/pipeline.py @@ -177,9 +177,7 @@ def run( # noqa: PLR0915, PLR0912 without outgoing connections. :raises PipelineRuntimeError: - If the Pipeline contains cycles with unsupported connections that would cause - it to get stuck and fail running. - Or if a Component fails or returns output in an unsupported type. + If a Component fails or returns output in an unsupported type. :raises PipelineMaxComponentRuns: If a Component reaches the maximum number of times it can be run in this Pipeline. """