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

cli/printlog: improve compact exec log #6350

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

sluongng
Copy link
Contributor

@sluongng sluongng commented Apr 11, 2024

Fixed an issue in reconstructDir() where the filesInDir slice was
initiated with nil entries.

Rename the compact log file to have the right extension.

cli/printlog/BUILD Outdated Show resolved Hide resolved
cli/printlog/printlog.go Outdated Show resolved Hide resolved
cli/printlog/compact/compact.go Outdated Show resolved Hide resolved
cli/printlog/compact/compact.go Outdated Show resolved Hide resolved
}
spawnInputs = append(spawnInputs, file)
}
if slr.sort {
Copy link
Contributor

Choose a reason for hiding this comment

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

The old exec format didn't sort the individual fields of the spawn proto as those are already deterministically ordered (based on depset order). Instead, to make the log more comparable overall, we would need to sort the protos with respect to each other.

Bazel topologically sorts by consumer-producer relationship and then by output path, see https://github.com/bazelbuild/bazel/blob/5d4feefed7e39b20a6c5deb5f74394abbf622a52/src/main/java/com/google/devtools/build/lib/exec/StableSort.java#L55. I think that this is what we should do if -sort is specified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im a bit afraid of implementing this.

Currently, we are converting from the new compact format to the old format, which is big and could take a long time to sort.
But perhaps it's fine because we are not processing the log inside the invocation. 🤔

Let me give it a try.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's possible to sort the new compact format directly as consumer/producer relationships can only be discovered after you have "flattened" the input/output file sets. If you want, we could take a look at this together at some point and see whether we can do better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed the --sort for now.

This PR is now a lot smaller to fix obvious bugs and add some minor doc improvements.

PTAL.

@sluongng sluongng force-pushed the sluongng/compact-exec-improvements branch from 73ac678 to 360bf29 Compare April 11, 2024 13:05
Fixed an issue in `reconstructDir()` where the filesInDir slice was
initiated with nil entries.

Rename the compact log file to have the right extension.
@sluongng sluongng force-pushed the sluongng/compact-exec-improvements branch from 360bf29 to bbc85ca Compare April 11, 2024 13:07
@sluongng sluongng requested a review from fmeum April 11, 2024 13:07
@sluongng sluongng merged commit 9e1e3b4 into master Apr 11, 2024
18 checks passed
@sluongng sluongng deleted the sluongng/compact-exec-improvements branch April 11, 2024 13:32
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.

None yet

2 participants