bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Provide mechanism to stream action output

Open picnoir opened this issue 6 years ago • 8 comments

Description of the feature request:

We currently cannot stream a build rule output to the terminal. We could replicate the analogous test flag --test_output=streamed in the build execution phase.

In that case, this would probably mean we would have to run the build actions sequentially in order to prevent any race condition on the terminal output.

Feature requests: what underlying problem are you trying to solve with this feature?

Some building tools [1] are not guaranteed to terminate. For such tools, having access to stdout/stderr is the only way we get to:

  1. Realize the build won't terminate.
  2. Investigate on what makes the build looping.

[1] Tools such as GHC, the Haskell compiler. See https://github.com/tweag/rules_haskell/issues/603

picnoir avatar Jan 22 '19 13:01 picnoir

This would be super useful for build rule authors in general, since debugging a hanging tool with no access to stdout/stderr is super difficult.

For what it's worth, one approach to debugging a sh_binary is to triage the error location within the script by adding exit 1 (which results in all output being printed).

RNabel avatar Feb 08 '19 11:02 RNabel

A possible workaround is using bazel build -s ... to print the subcommands that bazel is running. Then you can copy paste the one that gets stuck if you need to troubleshoot. You can also disable parallelism by passing --jobs=1. Does that help?

susinmotion avatar Sep 25 '19 20:09 susinmotion

I was so surprised when I realised there's no easy way to stream action build output in Bazel. It seems like a very necessary thing to be able to do. I have a very long build process, and it would be very helpful to be able to stream the output.

So definitely a +1 from me to implement this.

burdiyan avatar Sep 23 '21 11:09 burdiyan

  1. Realize the build won't terminate.

I am here.

pauldraper avatar Oct 20 '21 01:10 pauldraper

+1 For super long running actions. It's nice to be able to see where they are at progress wise

QuantamHD avatar Apr 08 '22 00:04 QuantamHD

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

github-actions[bot] avatar Jun 13 '23 01:06 github-actions[bot]

@bazelbuild/triage

domfarolino avatar Jun 13 '23 08:06 domfarolino

+1 on prioritizing this. This is the no.1 blocker for using Bazel extensively to manage slow and complex setups and preprocessing, e.g., for preparing machine learning training data etc.

appthumb avatar May 12 '24 13:05 appthumb