-
Notifications
You must be signed in to change notification settings - Fork 4.4k
API for Skylark rules and genrules to declare ResourceSets #6477
Description
Description of the problem / feature request:
My project uses multithreaded code emitters written in Java. They may eat CPU and RAM, and when running concurrently may overwhelm the build host. It'd be great if I could somehow signal to Bazel's scheduler that these processes are heavier so that it could adjust accordingly.
Feature requests: what underlying problem are you trying to solve with this feature?
When porting a project from Maven to Bazel, I observe longer build times with Bazel. Looking at the critical path, I see that a few actions--most notably one of the code emitters--takes significantly longer under Bazel (23s) than when run from the command line (15s) or Maven.
If I understand the code correctly (GenRuleAction.java), Bazel treats all genrules the same. They're assumed to consume ~300M of RAM and a single CPU. My tasks, however, typically occupy 2-4 CPUs, so I'd like Bazel to take this into account when scheduling actions running on my build host.
I'm still too new to Bazel to suggest a concrete API, but maybe something like
genrule(
...,
resources=(512, 3.0, 0.0), # Corresponds to ResourceSet: 512M, 3 CPUs, 0/default for I/O
)
# or
genrule(
...,
resources_ram=512,
resources_cpu=3.0,
) would be feasible? (Ditto for plain rules, too!)
What operating system are you running Bazel on?
Linux (CentOS 6.6)
What's the output of bazel info release?
$ bazel info release
release 0.16.1- (@non-git)(This is 0.18.0rc8.)
If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.
n/a. This is just a feature request.
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
n/a. This is just a feature request.
Have you found anything relevant by searching the web?
#988 touches on a similar topic.