Skip to main content
type ExecLogSink type ExecLogIter type iterator type file function compact_file
def compact_file(
*,
path: str
) -> bazel.execlog.ExecLogSink
Write this build’s compact execution log, byte for byte as Bazel’s --execution_log_compact_file would. One path holds one log. A task that retries its Bazel invocation spawns a build per attempt, and each writes this path afresh, so what is left when the task ends is the last attempt’s log rather than all of them. Name a path per attempt if every attempt’s log has to survive. Bazel writes the log into the task invocation’s history (a temp file when the history cannot be written); the CLI copies it to every compact path, and to one the command line or an rc file names. An earlier run’s file at a copy’s path is removed, so a build that writes no log leaves none there. A copy that cannot be written fails build.wait(), naming the path, while the build’s other execution-log consumers still get the whole log. function record
def record() -> bazel.execlog.ExecLogSink
Have Bazel write this build’s compact execution log, with nothing to read it and no copy: it is kept in the task invocation’s history, and Bazel uploads it as a build tool log wherever a BES backend is wired. record_every_build() does the same for every build of the task. Recording needs the build’s rc, since Bazel’s own rc files could name a log path no flag shows, and Bazel 7.4 or later, and is skipped beside an --execution_log_binary_file or --execution_log_json_file, since Bazel takes one format at a time. Without a history that can be written the log goes to a temp file, where Bazel still uploads it. function record_every_build
def record_every_build() -> None
Have every Bazel build and test of this task invocation write its compact execution log as record() does, whatever its own execution_log= says: a user’s config opting in to keeping every log. The user’s --bazel-flags:omit does not apply, so a feature asks through a BazelTrait.task_flags hook naming --execution_log_compact_file=%aspect_history% instead, which it does. Skipped on a Bazel older than 7.4, as record() is.