-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Return intermediate nodes output in pipelines #1558
Conversation
…ssue (they now run locally)
…nd to make the suite more structured)
…and output of the node alongside it
…ry node when defined
…ault would override the params values
…e specific settings
…s infinite recursion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already looking very good. Left three minor comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hey I'll put back ImMemoryLogger in schema.py for now, because in utils.py it causes a circular import issue :/ |
Related to #1193
Proposed changes:
These changes make nodes capable of recording some debug information during execution. This is accomplished by managing one extra key in the output dictionary, called
_debug
.By default, the data collected includes the input, the output and the logs produced by nodes (all or some of the nodes, depending on the configuration). However, a node can choose to add its own debug information under
_debug
, and such information will be preserved. The content of each node's_debug
entry will be in the final response (grouped by producer, see sample output below).Note that the content of
_debug
is generally passed from node to node, but to avoid infinite recursion it is removed from the output that is stored in the_debug
key itself (see example output below)Details:
Modifies
BaseComponent.run()
to make every node acceptdebug
anddebug_logs
as parameters, and if detected, saves them in the instance state as attributes. This will enable users to set these values throughpipeline.run(params={'node_name':{'debug': True}})
.Modifies
pipeline.run()
to acceptdebug
anddebug_logs
as attributes, and to apply them to each node's parameters, overwriting whatever was set in the params (see the example below).Modifies
BaseComponent._dispatch_run()
to deal properly with the_debug
key's content.For the logs collection, introduces an implicit decorator to
BaseComponent.run()
that, if it detects the attributedebug
, set toTrue
, in the state of the current object, will record the debug logs of the execution of a specific node and push them to their_debug
. These logs are also printed to the consoledebug_logs
is also defined and set toTrue
.Example code:
Example output:
Status (please check what you already did):