-
Notifications
You must be signed in to change notification settings - Fork 75
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
revert: restore line printing in tracer #1304
base: master
Are you sure you want to change the base?
Conversation
Hi! Was this a bug introduced recently? I'd love to add a failing test for this. If you could point me out at how to reproduce the error and the expected behaviour, I could help with the test. |
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.
Ok I understood now: printing/logging has nothing to do in the computation log, which is just a log accumulator —like a writer monad transformer, sort of.
In test_runner.py
, you could either:
- Get the log buffer and log it to stdout there.
- Pass down a function to the tracer with how you want to print/log the log buffer.
Something like this should give you what you want (just an idea):
# task_runner.py
@staticmethod
def print_computation_log(tracer, aggregate, max_depth) -> None:
buffer = tracer.computation_log.lines(aggregate, max_depth)
for line in buffer:
print(line)
Also, using print
is making the linter fail in CI, you have to use a logger for that:
https://docs.python.org/3/library/logging.html
Hope it helps :)
BTW, I have no idea how to test test_runner.py
, so I won't be picky with that.
(Also, if this wasn't working before, I'd do a minor bump and label it as a new feature. It it was working before, then you can just safely ignore this comment and keep it as a patch.)
Thanks @bonjourmauko , I don't have much time to follow up. To me, this is a regression and I need this fix to work locally. |
@guillett If you give me the command you normally use I can propose you a stacked PR with the proposed fix. Concerning |
Oh nevermind, I see the regression was introduced here 2f8072f#diff-fc2477fbba8037857fb9287895920ee5a1015c5eda4edb50832af14232fdd10b |
for _ in self.lines(aggregate, max_depth): | ||
pass | ||
for line in self.lines(aggregate, max_depth): | ||
print(line) |
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.
print(line) | |
print(line) # noqa: T201 |
Fixes #1310
Technical changes
computation_log
.