How to query build graph for actions and action details?

806 views
Skip to first unread message

Alpha Lam

unread,
Oct 26, 2015, 11:23:00 PM10/26/15
to bazel-discuss
Hi all,

I know I can query target dependencies using bazel query. But is there a way to see action dependencies? I would like to see how a target is built down to each action, the input, output and command for each action. This is similar to to make -pn.

If Bazel doesn't have this feature today then is it interesting to have? Is there an API to query this?

Thanks.

Alpha

Kristina Chodorow

unread,
Oct 27, 2015, 11:31:26 AM10/27/15
to Alpha Lam, bazel-discuss
You might be interested in `bazel dump --skyframe=detailed` to get a dump of the build graph's current state (you have to do a build first).  Bazel doesn't really have a "dry run" option, but you can run it with -s (--subcommands) to see each command being executed.

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/CABJijUpe5rO_26jW-hE2vNJZPW0V6Rkas7NtTfTvs7xota1U6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Alpha Lam

unread,
Oct 27, 2015, 1:17:33 PM10/27/15
to Kristina Chodorow, bazel-discuss
The information from skyframe=detailed is pretty interesting. It will be very useful if this dump can be standardized and visualized, including the commands invoked. Would this be an interesting feature to have? 

Kristina Chodorow

unread,
Oct 27, 2015, 1:25:18 PM10/27/15
to Alpha Lam, bazel-discuss
If you notice at the top of the output, it says "Warning: this information is intended for consumption by developers only, and may change at any time.  Script against it at your own risk!" So I don't think so :)  What do you want this info for?

Alpha Lam

unread,
Oct 27, 2015, 2:06:30 PM10/27/15
to Kristina Chodorow, bazel-discuss
For:
1) Visualization and debugging.
2) For reading by a program to analyze the build action graph.

Alpha

Lukács T. Berki

unread,
Oct 27, 2015, 4:35:50 PM10/27/15
to Alpha Lam, Kristina Chodorow, bazel-discuss
I am somewhat reluctant to making the action graph available in an easily digestible form, because we'd like to keep the right to change it at any time and without warning.

That said, I think the use cases you listed are reasonable, and we should support it, but we have our hands full with other things at the moment. There are a few other graphs that could be dumped or queried on (e.g. the configured target graph), but we don't even have vague plans for it apart from "would be nice if someone waved a magic wand and made this happen without any effort on our part".


For more options, visit https://groups.google.com/d/optout.



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Maximillianstr. 11-15 | 80539 München | Germany | Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle | Registergericht und -nummer: Hamburg, HRB 86891

Alpha Lam

unread,
Oct 27, 2015, 5:23:13 PM10/27/15
to Lukács T. Berki, Kristina Chodorow, bazel-discuss
So it sounds like this feature is nice to have, as long as it is understood that it can be changed any time in the future.

I filed an issue to track this: https://github.com/bazelbuild/bazel/issues/536

Alpha
Reply all
Reply to author
Forward
0 new messages