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

Reintroduce debug as a valid global key for Pipeline's params #2298

Merged
merged 3 commits into from
Mar 11, 2022

Conversation

ZanSara
Copy link
Contributor

@ZanSara ZanSara commented Mar 10, 2022

Problem
Passing the debug parameter to a pipeline as a global arg (like p.run(query="Why?", params={"debug": True}) ) did not work, as debug was not included in the set of valid global parameters which was populated from node signatures.

Solution
Add debug in the valid global parameters set in Pipeline.run()

@julian-risch
Copy link
Member

Please note that pipeline.run() has a debug parameter:

debug: Optional[bool] = None,

@ZanSara Maybe there is some confusion regarding that?

@ZanSara
Copy link
Contributor Author

ZanSara commented Mar 10, 2022

AFAIK we allow both options by design. We actually have several ways to enable debug output in a pipeline:

  1. By setting it to one component explicitly: es_retriever.debug = True

  2. By providing a debug as a parameter to one component at run: result = p.run(query="Why?", params={"ESRetriever": {"debug": True}})

  3. By providing it as a global parameter of the pipeline: result = p.run(query="Why?", params={"debug": True})

  4. By setting it explicitly to the pipeline: result = p.run(query="Why?", debug=True)

We can argue they're too many ways, but as long as they're documented I think they should all work. In addition, the code looks like all the four options worked well at some point, and this is a regression (just check how small is the change I needed to make to re-enable option 3).

However, deprecating some of these is also an option. @brandenchan what do you think?

@brandenchan
Copy link
Contributor

brandenchan commented Mar 10, 2022

So I see that option 2. is a needed feature so we should definitely keep that in code and document it.

We also need a global debug method and I don't mind whether we have 3. / 4. / both. Option 4. will have a nice docstring accompanying it but Option 3. is perhaps a little closer to how they are used in option 2. Either way, I think its better in our docs if we only recommend one of the two.

Option 1. should be a byproduct of having the global debug so I imagine it will always work, but I also think that we don't have to document this.

@ZanSara
Copy link
Contributor Author

ZanSara commented Mar 10, 2022

Ok, I agree option 2 is necessary as it is and option 1 is a byproduct of 2. Between 3 and 4, what do you prefer? I have no preference to be honest. Keeping both is not an issue code-wise, but I will disable either of them for clarity if we decide that it's better that way 🙂

@julian-risch
Copy link
Member

julian-risch commented Mar 10, 2022

However, deprecating some of these is also an option. @brandenchan what do you think?

If we decide to deprecate one of the options then I'd argue for deprecating option 4 (result = p.run(query="Why?", debug=True)). It was added in this PR: #1558 but we can achieve the same with option 3: result = p.run(query="Why?", params={"debug": True})

@julian-risch
Copy link
Member

That way, debug is handled in the same way as any other parameter that can be passed to all nodes.

@brandenchan
Copy link
Contributor

If we decide to deprecate one of the options then I'd argue for deprecating option 4 (result = p.run(query="Why?", debug=True)). It was added in this PR: #1558 but we can achieve the same with option 3: result = p.run(query="Why?", params={"debug": True})

Sure I can get behind this though currently I don't feel a strong need to deprecate one.

Copy link
Contributor

@brandenchan brandenchan left a comment

Choose a reason for hiding this comment

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

LGTM

@ZanSara ZanSara merged commit 85571cd into master Mar 11, 2022
@ZanSara ZanSara deleted the fix_global_debug_param branch March 11, 2022 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:pipeline type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants