forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow @rule-authors to give rules names (pantsbuild#8592)
## Problem We want rule authors to be able to control what @rules are and are not important enough to be reported, to avoid creating gigantic numbers of workunits that would clog up any reporting infrastructure built on top of workunits. ## Solution This commit adds the ability to specify a name: str keyword argument to @rule and @console_rules (e..g @rule(name='Some human-readable name')\ndef a_rule_fn(a: A) -> B). @console_rules names are automatically filled in from the name of their associated goal, although this can be overridden with an explicit argument. When a workunit is about to be created in nodes.rs as part of the NodeKey run function, we check to see whether this Node has a defined display_info - a string that right now is only provided by the name parameter to an @rule, although we can extend this in the future. If there is such a string, we add a workunit whose name is that string to the workunit store. If not, we ignore it. (Note that we also add Workunits to the store with hardcoded names in a few places pertaining to filesystem and remote operations, which this commit doesn't change). ## Result With this commit, the number of workunits recorded in the workunit store (and thus reported to zipkin) will be drastically decreased, since now only @console_rules have a name by default. A rule author can restore workunits associated with any @rule by giving that @rule a name.
- Loading branch information
Showing
18 changed files
with
223 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.