From 34bca2ba835b8046d6c7d2cca22c3902f64fbd0c Mon Sep 17 00:00:00 2001 From: Sara Zan Date: Tue, 26 Apr 2022 09:24:19 +0200 Subject: [PATCH] Make sure that `debug=True` and `params={'debug': True}` behaves the same way (#2442) * Make sure that debug=True and params={'debug': True} behaves the same way * Update Documentation & Code Style * Account for the possibility of node_input being None * Fix condition * Avoid situation where params=None Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- haystack/pipelines/base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/haystack/pipelines/base.py b/haystack/pipelines/base.py index a60206bfb..3e8ff547e 100644 --- a/haystack/pipelines/base.py +++ b/haystack/pipelines/base.py @@ -647,7 +647,12 @@ class Pipeline(BasePipeline): # Apply debug attributes to the node input params # NOTE: global debug attributes will override the value specified # in each node's params dictionary. + if debug is None and node_input: + if node_input.get("params", {}): + debug = params.get("debug", None) # type: ignore if debug is not None: + if not node_input.get("params", None): + node_input["params"] = {} if node_id not in node_input["params"].keys(): node_input["params"][node_id] = {} node_input["params"][node_id]["debug"] = debug