Add an option for printing selected server logs on failure.#6591
Add an option for printing selected server logs on failure.#6591EdSchouten wants to merge 2 commits intobazelbuild:masterfrom
Conversation
|
Hi Ed, have you considered implementing a BES service in Buildbarn? I think that might be a more idiomatic way to do what you want to do. We also have the See e.g. https://source.cloud.google.com/results/invocations/48d7938b-2f43-4585-b51d-19fd7113c776/targets and |
|
Hi Jakob. Hope you're doing well! \o/ The Build Event Service looks pretty neat as well, but I think it fulfills a different purpose. The BES acts as a high-level logging system for full Bazel build/test runs (the 'top half' of Bazel). The page I built is intended for inspecting the literal data structures used by remote execution (the 'bottom half' of Bazel). It can, for example, be used to browse the input root of a build action stored in the CAS. This is quite valuable when diagnosing issues in the remote build implementation or self-made build rules. For those who are curious, below is a screenshot of bbb_browser showing information about a failed build action: |
|
Thanks for explaining. You are indeed correct. This looks great! I have two questions:
|
|
Below is a screenshot of what this looks like for a couple of errors in a row. Notice that they are all printed right above the corresponding With regards to using |
|
You are right with regard to status - I always mix this up :-). We can do this. I am not convinced that using server_log is the right approach in the long term but it's an acceptable solution for now:
I think a better approach would be to add an |
As mentioned in bazelbuild/bazel#6591, Bazel Buildbarn now ships with a web service that can be used to explore data stored in the CAS and AC. By adding an extra field to ExecuteResponse, we can let Bazel automatically report URLs to the user pointing to the correct page. These URLs could, for example, be printed for build steps that fail.
|
Having an
I just opened this pull request: bazelbuild/remote-apis#36. Let's close this one and continue discussion there. Thanks! |
buchgr
left a comment
There was a problem hiding this comment.
I wonder if it would make sense to simply append this information to the stderr instead of posting it as an info event. That has the additional advantage of this information being printed after the error message, which seems nicer to me.
src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnRunner.java
Outdated
Show resolved
Hide resolved
|
@EdSchouten I wasn't suggesting for you to close this one. I think we could certainly merge this as-is and iterate. |
fd0698e to
915fdfd
Compare
b9bdc82 to
249aace
Compare
|
Hi Jakob, I've just altered this pull request to no longer use server logs. Instead, it now uses the That said, it would also be interesting to show this information for successful targets when not too noisy. Being able to obtains links to those would allow people to share build output (e.g., firmware images) with each other. I was thinking that |
I think this is the classic BEP/BES use case and best implemented there. The BEP will reference all outputs of top level targets and Bazel can upload this information via the BES protocol and also print a link (--bes_results_url) to a user readable page. The BEP can reference output files as a link to the CAS of the remote execution system. So I think that would be perfect for what you want to do. |
| String message = reply.getMessage(); | ||
| if ((reply.getResult().getExitCode() != 0 || | ||
| reply.getStatus().getCode() != Code.OK.value()) && !message.isEmpty()) { | ||
| outErr.printErr(message + "\n"); |
There was a problem hiding this comment.
Just to clarify:
- For build failures Bazel will print this to the UI
- For test failures this will be the last line in the test.log
Correct?
There was a problem hiding this comment.
Exactly. It's printed in those two conditions.
|
Ping @EdSchouten :-) |
This includes the new ExecuteResponse's message field that is dedicated to containing log entries that may be printed to the user.
The message may contain additional information that the user may use to diagnose failures. Bazel Buildbarn will emit messages containing links to its web frontend that can be used to inspect actions (command, input root, etc.) in more detail.
249aace to
b5afa24
Compare
Pong! Sorry for letting you folks wait. |
…uild#6591 Bazel Buildbarn recently gained a web frontend called bbb_browser that can be used to explore the CAS/AC. It allows users to get better insight in how remote execution works under the hood. It also makes it possible for users to more easily share information on build failures with their peers. In order to make it easy for people to access this service, we'd like build failures to automatically print links to the corresponding page in bbb_browser to the terminal. We want to use the remote execution APIs message field for that.
…uild#6591 Bazel Buildbarn recently gained a web frontend called bbb_browser that can be used to explore the CAS/AC. It allows users to get better insight in how remote execution works under the hood. It also makes it possible for users to more easily share information on build failures with their peers. In order to make it easy for people to access this service, we'd like build failures to automatically print links to the corresponding page in bbb_browser to the terminal. We want to use the remote execution APIs message field for that. Closes bazelbuild#7234. PiperOrigin-RevId: 230695190



Bazel Buildbarn recently gained a web frontend called bbb_browser that
can be used to explore the CAS/AC. It allows users to get better insight
in how remote execution works under the hood. It also makes it possible
for users to more easily share information on build failures with their
peers.
In order to make it easy for people to access this service, we'd like
build failures to automatically print links to the corresponding page in
bbb_browser to the terminal. RE's server_logs feature is ideally suited
for this. Unfortunately, there exists no mechanism to print the output
of these files to the terminal yet.
This change adds a new command line flag, --print_server_log_on_failure,
that can print selected server logs to the terminal automatically. Logs
are identified by the key that was used to store them in the map.