2929from haystack .core .pipeline .component_checks import (
3030 _NO_OUTPUT_PRODUCED ,
3131 all_predecessors_executed ,
32- are_all_lazy_variadic_sockets_resolved ,
3332 are_all_sockets_ready ,
3433 can_component_run ,
3534 is_any_greedy_socket_ready ,
@@ -76,8 +75,7 @@ class ComponentPriority(IntEnum):
7675 HIGHEST = 1
7776 READY = 2
7877 DEFER = 3
79- DEFER_LAST = 4
80- BLOCKED = 5
78+ BLOCKED = 4
8179
8280
8381class PipelineBase : # noqa: PLW1641
@@ -1200,9 +1198,9 @@ def _calculate_priority(comp: dict, comp_inputs: dict[str, list[dict[str, Any]]]
12001198 if all_predecessors_executed (comp , comp_inputs ):
12011199 # This priority is explicitly used in AsyncPipeline + in _is_queue_stale
12021200 return ComponentPriority .READY
1203- if are_all_lazy_variadic_sockets_resolved ( comp , comp_inputs ):
1204- return ComponentPriority . DEFER
1205- return ComponentPriority .DEFER_LAST
1201+ # If we make it here it means the component can run but is waiting for more inputs, so we give it the lowest
1202+ # priority. This way, components that are ready to run will be prioritized over ones assigned with this prio.
1203+ return ComponentPriority .DEFER
12061204
12071205 def _get_component_with_graph_metadata_and_visits (self , component_name : str , visits : int ) -> dict [str , Any ]:
12081206 """
@@ -1306,8 +1304,8 @@ def _tiebreak_waiting_components(
13061304 """
13071305 Decides which component to run when multiple components are waiting for inputs with the same priority.
13081306
1309- NOTE: This was designed to only tie-break for priorities DEFER and DEFER_LAST . Since this function also removes
1310- these components from the priority queue we rely on _is_queue_stale to then refill the priority queue.
1307+ NOTE: This was designed to only tie-break for components with the priority DEFER . Since this function also
1308+ removes these components from the priority queue we rely on _is_queue_stale to then refill the priority queue.
13111309 And _is_queue_stale only triggers when all remaining components have BLOCKED priority.
13121310
13131311 :param component_name: The name of the component.
@@ -1320,16 +1318,10 @@ def _tiebreak_waiting_components(
13201318 """
13211319 # Create a list of all components that have the same priority as the current component, including the
13221320 # current component itself and remove them from the priority queue.
1323- has_deferred_priority = priority in [ComponentPriority .DEFER , ComponentPriority .DEFER_LAST ]
13241321 components_with_same_priority = [component_name ]
13251322 while len (priority_queue ) > 0 :
13261323 next_priority , next_component_name = priority_queue .peek ()
1327- # For tiebreaking purposes we treat DEFER and DEFER_LAST as the same priority.
1328- if (
1329- has_deferred_priority
1330- and next_priority in [ComponentPriority .DEFER , ComponentPriority .DEFER_LAST ]
1331- or next_priority == priority
1332- ):
1324+ if priority == ComponentPriority .DEFER and next_priority == ComponentPriority .DEFER :
13331325 priority_queue .pop () # actually remove the component
13341326 components_with_same_priority .append (next_component_name )
13351327 else :
0 commit comments