-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false sharing in action cache due to incorrect key computation fo…
…r custom Starlark command lines. Actions constructing arguments in Starlark can define them as a lazy evaluation, which will be run when we are about to execute the action, using `Args.add_all`. `Args.add_all` offers a `expand_directories` feature which causes all of the directories in the args list to be replaced with the files in the directory at the time of evaluation. When this option is used in conjunction with `map_each`, the behavior is to first expand the directory and than run the provided function on each of the elements of the expanded array. `ArtifactExpander`, used to expand the directories, is not available before execution phase. Given `Action.getKey` can be called before that (and is for instance for shared actions detection), we currently compute the fingerprint without expanding directories. In fact, current implementation, calls the provided function on the directory itself rather than expanded list of files in it. As a result of that, if we have 2 functions which return the same value for the directory, but differ for the files in it, the key will not denote them as different. That leads to false sharing of actions through the action cache, which is based on action fingerprints. Action cache checks happen during execution phase, when we technically have the ability to expand the directories. Expand the fingerprinting function to take advantage of `ArtifactExpander` when it is provided to produce the key based on the result of actual function execution. Rework the `ActionExecutionFunction` to provide `ArtifactExpander` to logic computing keys for action caches. PiperOrigin-RevId: 323090803
- Loading branch information
1 parent
636fb5e
commit e6cce76
Showing
15 changed files
with
494 additions
and
96 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
Oops, something went wrong.