-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starlark API to allow rules and genrules to declare ResourceSets #8107
Conversation
This doesn't quite belong under Starlark team IMO. The "API change" itself doesn't constitute much of a Starlark semantic change -- it simply expands the set of meaningful action execution requirements (all strings are accepted, I believe, but only some strings have meaning. this is increasing the list of strings which have meaning). (FWIW, this change in Starlark seems fine, but I don't know about the ramifications of the rest of the code) |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for doing this! Just today I was talking to someone and saying that this feature existed but wasn't exposed to Starlark, so this is very timely.
src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java
Outdated
Show resolved
Hide resolved
*/ | ||
public ValidationException(String tagValue, String errorMsg) { | ||
super(errorMsg); | ||
this.tagValue = tagValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we guarantee in some way that the error message contains the tag value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I can go in either direction, but I'd like to point out that this is copied/pasted from ParseableRequirement.ValidationException
. Similarly, the error handler in SkylarkActionFactory.java
is directly influenced by the one from TestTargetProperties.java
.
What's the dominant convention? (Throwers of InvalidPackageNameException
don't include bad values in their error message, while throwers of EvalException
sometimes do.)
src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/devtools/build/lib/actions/ExecutionRequirements.java
Outdated
Show resolved
Hide resolved
|
||
/** Integer validator to use with {@link ParseableRequirement} and {@link TaggedRequirement}. */ | ||
private static String IntegerValidator(String s) { | ||
Preconditions.checkNotNull(s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would we expect this to be null? I think never, so it's fair to assume it's not null and let the code below crash if it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a traveler in a foreign codebase, I'm totally okay with removing it, but that check predates me, fwiw. (See da21ba7.)
src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkActionFactory.java
Show resolved
Hide resolved
This change allows rule writers to define CPU and memory requirements for rules. It's intended to help avoid overcommitting a build host when invoking multithreaded or memory-intensive commands. The approach taken was discussed both in #6477 and https://groups.google.com/d/msg/bazel-dev/HaZuVmx6dfk/h6WnlabHCQAJ. In a future change, `TaggedRequirement` could replace (and be renamed to) `ParseableRequirement`. Resolves #6477.
@jmmv Can we please revisit this? You provided some feedback which I responded to with some clarifying questions of my own. It'd be nice if this (or something better) were accepted into 1.0. |
@jmmv What's the status of this? |
@jmmv - ping for review |
It looks like Action Groups supersedes this? (Proposal: https://docs.google.com/document/d/1m9xLRLg09lncQTuBUMhhG_lqDQGJRYMZPejvwdBXvqo/edit#heading=h.5mcn15i0e1ch ; search for cc @juliexxia |
Sorry for the bogus cc; my attention is split atm. (Julie commented on the parent issue.) Since Action Groups w/ exec properties is underway, I'm going to discard this. |
This change allows rule writers to define CPU and memory requirements for
rules. It's intended to help avoid overcommitting a build host when
invoking multithreaded or memory-intensive commands.
The approach taken was discussed both in #6477 and
https://groups.google.com/d/msg/bazel-dev/HaZuVmx6dfk/h6WnlabHCQAJ.
In a future change,
TaggedRequirement
could replace (and be renamedto)
ParseableRequirement
.Resolves #6477.