forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have
ActionRewindStrategy
throw a more general `ActionRewindExcepti…
…on` when an action loses inputs too many times. `ActionRewindException` is thrown instead of `ActionExecutionException`, which is specific to `ActionExecutionFunction`. When rewinding top-level outputs, we also need to handle the possibility of ineffective rewinding, but an `ActionExecutionException` cannot be constructed since there is no failed `Action` associated with the lost digest. Instead, have the caller catch `ActionRewindException` and construct a relevant exception type. PiperOrigin-RevId: 604668674 Change-Id: I61a1bfb2f383cebe7852f33b08f0117b3e0d1dd3
- Loading branch information
1 parent
6932153
commit 1a46a6f
Showing
4 changed files
with
58 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/google/devtools/build/lib/skyframe/rewinding/ActionRewindException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2024 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.skyframe.rewinding; | ||
|
||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
import com.google.devtools.build.lib.server.FailureDetails.ActionRewinding; | ||
import com.google.devtools.build.lib.server.FailureDetails.FailureDetail; | ||
import com.google.devtools.build.lib.skyframe.DetailedException; | ||
import com.google.devtools.build.lib.util.DetailedExitCode; | ||
|
||
/** Exception thrown by {@link ActionRewindStrategy} when it cannot compute a rewind plan. */ | ||
public final class ActionRewindException extends Exception implements DetailedException { | ||
private final ActionRewinding.Code code; | ||
|
||
ActionRewindException(String message, Exception cause, ActionRewinding.Code code) { | ||
super(message, cause); | ||
this.code = checkNotNull(code); | ||
} | ||
|
||
@Override | ||
public DetailedExitCode getDetailedExitCode() { | ||
return DetailedExitCode.of( | ||
FailureDetail.newBuilder() | ||
.setMessage(getMessage()) | ||
.setActionRewinding(ActionRewinding.newBuilder().setCode(code)) | ||
.build()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters