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

Reduce noisy log messages from @rule params #10658

Merged
merged 2 commits into from
Aug 20, 2020

Conversation

gshuflin
Copy link
Contributor

Problem

cf. #10518 , it's possible for pants to emit extremely large log messages whenever it prints a long containing the string representation of large Python types. In the above issue, the large Python types are FieldSet subclasses (which can include lots of e.g. file path names) in their Python __str__ representation. These types appear as the params field on a Task, and are part of the Rust Display representation of a Task, which is part of the log message when a node is invalidated because of a file system change, and might more generally show up in any pants log message.

Solution

A quick fix for the above problem is to simply remove the Params from the Display implementation of an @rule's task, and only include the name of the Python function corresponding to the rule. cf. #7907 , we probably want to eventually implement a more sophisticated way of deciding what Python type information we do and do not need to include in useful pants logs from Rust.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Thanks. This doesn't completely fix the issue, but it goes a long way to ameliorate it.

@@ -1248,7 +1248,11 @@ impl Display for NodeKey {
&NodeKey::Scandir(ref s) => write!(f, "Scandir({})", (s.0).0.display()),
&NodeKey::Select(ref s) => write!(f, "{}", s.product),
&NodeKey::Task(ref task) => {
write!(f, "@rule {}({})", task.task.display_info.name, task.params)
//TODO cf. https://github.com/pantsbuild/pants/issues/7907 , we probably
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: The convention is TODO(#7907). Would be good to fix so that people can find it via Grep.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I think each comment is supposed to have a single space between the // and the message.

//want to include some kind of representation of the Params of an @rule when
//we stringify the @rule. But we need to make sure we don't naively dump
//the string representation of a Key, which could get gigantic.
write!(f, "@rule {}", task.task.display_info.name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @rule(my_rule_name), rather than @rule my_rule_name. This would fit with the repr for the other node types a bit better.

[ci skip-build-wheels]
[ci skip-build-wheels]
@gshuflin gshuflin force-pushed the fix-noisy-messages branch from 4a6160a to 596122e Compare August 19, 2020 23:47
@coveralls
Copy link

coveralls commented Aug 20, 2020

Coverage Status

Coverage remained the same at 0.0% when pulling 596122e on gshuflin:fix-noisy-messages into de7d5c3 on pantsbuild:master.

@gshuflin gshuflin merged commit aa36ffd into pantsbuild:master Aug 20, 2020
@gshuflin gshuflin deleted the fix-noisy-messages branch August 20, 2020 00:41
@stuhood
Copy link
Member

stuhood commented Sep 14, 2020

Does #10665 mean that this could be reverted or cleaned up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants