Skip to content

Commit

Permalink
Change getValues to get(Ordered)ValuesAndExceptions in Skyframe T…
Browse files Browse the repository at this point in the history
…est files since `getValues` is going to be removed in Skyfunction.

PiperOrigin-RevId: 436186631
  • Loading branch information
emilyguo1 authored and copybara-github committed Mar 21, 2022
1 parent 702df84 commit 5f1087c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ public void cycleAboveIndependentCycle() throws Exception {
@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
env.getValues(ImmutableList.of(leafKey, bKey));
env.getOrderedValuesAndExceptions(ImmutableList.of(leafKey, bKey));
return null;
}
});
Expand Down Expand Up @@ -1243,8 +1243,8 @@ public void cycleAndSelfEdgeWithDirtyValueInSameGroup() throws Exception {
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
// The order here is important -- 2 before 1.
Map<SkyKey, SkyValue> result =
env.getValues(ImmutableList.of(cycleKey2, cycleKey1));
SkyframeIterableResult result =
env.getOrderedValuesAndExceptions(ImmutableList.of(cycleKey2, cycleKey1));
Preconditions.checkState(env.valuesMissing(), result);
return null;
}
Expand Down Expand Up @@ -1581,7 +1581,7 @@ public void nodeInvalidatedThenDoubleCycle() throws InterruptedException {
@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
env.getValues(ImmutableList.of(topKey, depKey));
env.getOrderedValuesAndExceptions(ImmutableList.of(topKey, depKey));
assertThat(env.valuesMissing()).isTrue();
return null;
}
Expand Down Expand Up @@ -2114,7 +2114,7 @@ public void errorInDependencyGroup() throws Exception {
.getOrCreate(topKey)
.setBuilder(
(skyKey, env) -> {
env.getValues(ImmutableList.of(errorKey, midKey, mid2Key));
env.getOrderedValuesAndExceptions(ImmutableList.of(errorKey, midKey, mid2Key));
if (env.valuesMissing()) {
return null;
}
Expand Down Expand Up @@ -2153,7 +2153,8 @@ public void valueInErrorWithGroups() throws Exception {
(skyKey, env) -> {
SkyKeyValue val =
((SkyKeyValue)
env.getValues(ImmutableList.of(groupDepA, groupDepB)).get(groupDepA));
env.getOrderedValuesAndExceptions(ImmutableList.of(groupDepA, groupDepB))
.next());
if (env.valuesMissing()) {
return null;
}
Expand Down Expand Up @@ -2519,7 +2520,8 @@ protected void runResetNodeOnRequest_withDeps(RunResetNodeOnRequestWithDepsMode
if (dep1 == null) {
return null;
}
env.getValues(ImmutableList.of(newlyRequestedDoneDep, newlyRequestedNotDoneDep));
env.getOrderedValuesAndExceptions(
ImmutableList.of(newlyRequestedDoneDep, newlyRequestedNotDoneDep));
if (numFunctionCalls.get() < 4) {
return Restart.SELF;
} else if (numFunctionCalls.get() == 4) {
Expand Down Expand Up @@ -2606,7 +2608,7 @@ private void missingDirtyChild(boolean sameGroup) throws Exception {
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
if (sameGroup) {
env.getValues(ImmutableSet.of(presentChild, missingChild));
env.getOrderedValuesAndExceptions(ImmutableSet.of(presentChild, missingChild));
} else {
env.getValue(presentChild);
if (env.valuesMissing()) {
Expand Down Expand Up @@ -2691,14 +2693,14 @@ public void sameDepInTwoGroups() throws Exception {
// Request the first group, [leaf0, leaf1, leaf2].
// In the first build, it has values ["leaf2", "leaf3", "leaf4"].
// In the second build it has values ["leaf2", "leaf3", "leaf5"]
Map<SkyKey, SkyValue> values = env.getValues(leaves);
SkyframeLookupResult values = env.getValuesAndExceptions(leaves);
if (env.valuesMissing()) {
return null;
}

// Request the second group. In the first build it's [leaf2, leaf4].
// In the second build it's [leaf2, leaf5]
env.getValues(
env.getOrderedValuesAndExceptions(
ImmutableList.of(
leaves.get(2),
GraphTester.toSkyKey(((StringValue) values.get(leaves.get(2))).getValue())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ public void incrementalCycleWithCatastropheAndFailedBubbleUp() throws Exception
@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
env.getValues(ImmutableList.of(cycleKey));
env.getValue(cycleKey);
return env.valuesMissing() ? null : topValue;
}
});
Expand All @@ -934,7 +934,7 @@ public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedExcept
@Nullable
@Override
public SkyValue compute(SkyKey skyKey, Environment env) throws InterruptedException {
env.getValues(ImmutableList.of(cycleKey, catastropheKey));
env.getOrderedValuesAndExceptions(ImmutableList.of(cycleKey, catastropheKey));
Preconditions.checkState(env.valuesMissing());
return null;
}
Expand Down Expand Up @@ -2042,7 +2042,7 @@ public void getValueOrThrowWithErrors(@TestParameter boolean keepGoing) throws E
} catch (SomeErrorException e) {
// Recover from the child error.
}
env.getValues(deps);
env.getOrderedValuesAndExceptions(deps);
if (env.valuesMissing()) {
return null;
}
Expand Down

0 comments on commit 5f1087c

Please sign in to comment.