Fixed an issue in critical path where an action with "parse" time will finish in the future.
RELNOTES: Actions with "parse" on the critical path should no longer finish in the future.
@@ -291,6 +291,10 @@ public class ActionExecutionFunction implements SkyFunction {
}
long actionStartTime = BlazeClock.nanoTime();
+ long attemptStartTime = actionStartTime;
+ if (state.actionStartNanos != 0) {
+ actionStartTime = state.actionStartNanos;
+ }
ActionExecutionValue result;
try {
result =
@@ -302,7 +306,8 @@ public class ActionExecutionFunction implements SkyFunction {
actionLookupData,
previousExecution,
skyframeDepsResult,
- actionStartTime);
+ actionStartTime,
+ attemptStartTime);
} catch (LostInputsActionExecutionException e) {
return handleLostInputs(
e, actionLookupData, action, actionStartTime, env, inputDeps, allInputs, state);
@@ -720,7 +725,8 @@ public class ActionExecutionFunction implements SkyFunction {
ActionLookupData actionLookupData,
@Nullable ActionExecutionState previousAction,
Object skyframeDepsResult,
- long actionStartTime)
+ long actionStartTime,
+ long attemptStartTime)
throws ActionExecutionException, InterruptedException {
if (previousAction != null) {
// There are two cases where we can already have an executing action for a specific output:
@@ -825,9 +831,12 @@ public class ActionExecutionFunction implements SkyFunction {
action,
/*catastrophe=*/ false);
} finally {
+ if (state.discoveredInputsDuration.isZero()) {
+ state.actionStartNanos = actionStartTime;
+ }
state.discoveredInputsDuration =
state.discoveredInputsDuration.plus(
- Duration.ofNanos(BlazeClock.nanoTime() - actionStartTime));
+ Duration.ofNanos(BlazeClock.nanoTime() - attemptStartTime));
}
Preconditions.checkState(
env.valuesMissing() == (state.discoveredInputs == null),
@@ -1348,6 +1357,7 @@ public class ActionExecutionFunction implements SkyFunction {
NestedSet<Artifact> discoveredInputs = null;
FileSystem actionFileSystem = null;
Duration discoveredInputsDuration = Duration.ZERO;
+ long actionStartNanos = 0;
/**
* Stores the ArtifactNestedSetKeys created from the inputs of this actions. Objective: avoid
