aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java11
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java49
-rw-r--r--src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java1
-rw-r--r--src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java3
4 files changed, 49 insertions, 15 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
index f903503bf6..9c038131dc 100644
--- a/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/actions/ActionExecutedEvent.java
@@ -41,6 +41,7 @@ public class ActionExecutedEvent implements BuildEventWithConfiguration, Progres
private final Action action;
private final ActionExecutionException exception;
+ private final Path primaryOutput;
private final Path stdout;
private final Path stderr;
private final ErrorTiming timing;
@@ -48,11 +49,13 @@ public class ActionExecutedEvent implements BuildEventWithConfiguration, Progres
public ActionExecutedEvent(
Action action,
ActionExecutionException exception,
+ Path primaryOutput,
Path stdout,
Path stderr,
ErrorTiming timing) {
this.action = action;
this.exception = exception;
+ this.primaryOutput = primaryOutput;
this.stdout = stdout;
this.stderr = stderr;
this.timing = timing;
@@ -90,10 +93,10 @@ public class ActionExecutedEvent implements BuildEventWithConfiguration, Progres
@Override
public BuildEventId getEventId() {
if (action.getOwner() == null) {
- return BuildEventId.actionCompleted(action.getPrimaryOutput().getPath());
+ return BuildEventId.actionCompleted(primaryOutput);
} else {
return BuildEventId.actionCompleted(
- action.getPrimaryOutput().getPath(),
+ primaryOutput,
action.getOwner().getLabel(),
action.getOwner().getConfigurationChecksum());
}
@@ -127,7 +130,7 @@ public class ActionExecutedEvent implements BuildEventWithConfiguration, Progres
localFiles.add(new LocalFile(stderr, LocalFileType.STDERR));
}
if (exception == null) {
- localFiles.add(new LocalFile(action.getPrimaryOutput().getPath(), LocalFileType.OUTPUT));
+ localFiles.add(new LocalFile(primaryOutput, LocalFileType.OUTPUT));
}
return localFiles.build();
}
@@ -168,7 +171,7 @@ public class ActionExecutedEvent implements BuildEventWithConfiguration, Progres
actionBuilder.setConfiguration(configuration.getEventId().asStreamProto().getConfiguration());
}
if (exception == null) {
- String uri = pathConverter.apply(action.getPrimaryOutput().getPath());
+ String uri = pathConverter.apply(primaryOutput);
if (uri != null) {
actionBuilder.setPrimaryOutput(
BuildEventStreamProtos.File.newBuilder().setUri(uri).build());
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
index 98b5c3cd90..215e7f0904 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeActionExecutor.java
@@ -677,8 +677,9 @@ public final class SkyframeActionExecutor {
} catch (ActionExecutionException e) {
throw processAndThrow(
env.getListener(),
- e,
+ actionExecutionContext,
action,
+ e,
actionExecutionContext.getFileOutErr(),
ErrorTiming.BEFORE_EXECUTION);
}
@@ -766,7 +767,7 @@ public final class SkyframeActionExecutor {
Preconditions.checkState(actionExecutionContext.getMetadataHandler() == metadataHandler,
"%s %s", actionExecutionContext.getMetadataHandler(), metadataHandler);
prepareScheduleExecuteAndCompleteAction(
- eventHandler, action, actionExecutionContext, actionStartTime, actionLookupData);
+ eventHandler, actionExecutionContext, action, actionStartTime, actionLookupData);
Preconditions.checkState(
actionExecutionContext.getOutputSymlinks() == null
|| action instanceof SkyframeAwareAction,
@@ -890,8 +891,8 @@ public final class SkyframeActionExecutor {
*/
private void prepareScheduleExecuteAndCompleteAction(
ExtendedEventHandler eventHandler,
- Action action,
ActionExecutionContext context,
+ Action action,
long actionStartTime,
ActionLookupData actionLookupData)
throws ActionExecutionException, InterruptedException {
@@ -924,6 +925,7 @@ public final class SkyframeActionExecutor {
boolean outputDumped = executeActionTask(eventHandler, action, context);
completeAction(
eventHandler,
+ context,
action,
context.getMetadataHandler(),
context.getFileOutErr(),
@@ -936,12 +938,14 @@ public final class SkyframeActionExecutor {
private ActionExecutionException processAndThrow(
ExtendedEventHandler eventHandler,
- ActionExecutionException e,
+ ActionExecutionContext actionExecutionContext,
Action action,
+ ActionExecutionException e,
FileOutErr outErrBuffer,
ErrorTiming errorTiming)
- throws ActionExecutionException {
- reportActionExecution(eventHandler, action, e, outErrBuffer, errorTiming);
+ throws ActionExecutionException {
+ reportActionExecution(
+ eventHandler, actionExecutionContext, action, e, outErrBuffer, errorTiming);
boolean reported = reportErrorIfNotAbortingMode(e, outErrBuffer);
ActionExecutionException toThrow = e;
@@ -1005,17 +1009,25 @@ public final class SkyframeActionExecutor {
}
// Defer reporting action success until outputs are checked
} catch (ActionExecutionException e) {
- throw processAndThrow(eventHandler, e, action, outErrBuffer, ErrorTiming.AFTER_EXECUTION);
+ throw processAndThrow(
+ eventHandler,
+ actionExecutionContext,
+ action,
+ e,
+ outErrBuffer,
+ ErrorTiming.AFTER_EXECUTION);
}
return false;
}
private void completeAction(
ExtendedEventHandler eventHandler,
+ ActionExecutionContext actionExecutionContext,
Action action,
MetadataHandler metadataHandler,
FileOutErr fileOutErr,
- boolean outputAlreadyDumped) throws ActionExecutionException {
+ boolean outputAlreadyDumped)
+ throws ActionExecutionException {
try {
Preconditions.checkState(action.inputsDiscovered(),
"Action %s successfully executed, but inputs still not known", action);
@@ -1035,16 +1047,23 @@ public final class SkyframeActionExecutor {
}
}
- reportActionExecution(eventHandler, action, null, fileOutErr, ErrorTiming.NO_ERROR);
+ reportActionExecution(
+ eventHandler, actionExecutionContext, action, null, fileOutErr, ErrorTiming.NO_ERROR);
} catch (ActionExecutionException actionException) {
// Success in execution but failure in completion.
reportActionExecution(
- eventHandler, action, actionException, fileOutErr, ErrorTiming.AFTER_EXECUTION);
+ eventHandler,
+ actionExecutionContext,
+ action,
+ actionException,
+ fileOutErr,
+ ErrorTiming.AFTER_EXECUTION);
throw actionException;
} catch (IllegalStateException exception) {
// More serious internal error, but failure still reported.
reportActionExecution(
eventHandler,
+ actionExecutionContext,
action,
new ActionExecutionException(exception, action, true),
fileOutErr,
@@ -1220,6 +1239,7 @@ public final class SkyframeActionExecutor {
private void reportActionExecution(
ExtendedEventHandler eventHandler,
+ ActionExecutionContext actionExecutionContext,
Action action,
ActionExecutionException exception,
FileOutErr outErr,
@@ -1233,7 +1253,14 @@ public final class SkyframeActionExecutor {
if (outErr.hasRecordedStderr()) {
stderr = outErr.getErrorPath();
}
- eventHandler.post(new ActionExecutedEvent(action, exception, stdout, stderr, errorTiming));
+ eventHandler.post(
+ new ActionExecutedEvent(
+ action,
+ exception,
+ actionExecutionContext.getInputPath(action.getPrimaryOutput()),
+ stdout,
+ stderr,
+ errorTiming));
}
/**
diff --git a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
index cda7069033..8657132910 100644
--- a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
+++ b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java
@@ -62,6 +62,7 @@ public class BazelBuildEventServiceModuleTest {
new ActionExecutedEvent(
new ActionsTestUtil.NullAction(),
/* exception= */ null,
+ ActionsTestUtil.DUMMY_ARTIFACT.getPath(),
/* stdout= */ null,
/* stderr= */ null,
ErrorTiming.NO_ERROR);
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
index d50717d9a7..7d7bbc424a 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
@@ -87,6 +87,7 @@ public class BuildEventStreamerTest extends FoundationTestCase {
new ActionExecutedEvent(
new ActionsTestUtil.NullAction(),
/* exception= */ null,
+ ActionsTestUtil.DUMMY_ARTIFACT.getPath(),
/* stdout= */ null,
/* stderr= */ null,
ErrorTiming.NO_ERROR);
@@ -912,6 +913,7 @@ public class BuildEventStreamerTest extends FoundationTestCase {
new ActionExecutedEvent(
new ActionsTestUtil.NullAction(),
new ActionExecutionException("Exception", /* action= */ null, /* catastrophe= */ false),
+ ActionsTestUtil.DUMMY_ARTIFACT.getPath(),
/* stdout= */ null,
/* stderr= */ null,
ErrorTiming.BEFORE_EXECUTION);
@@ -941,6 +943,7 @@ public class BuildEventStreamerTest extends FoundationTestCase {
new ActionExecutedEvent(
new ActionsTestUtil.NullAction(),
new ActionExecutionException("Exception", /* action= */ null, /* catastrophe= */ false),
+ ActionsTestUtil.DUMMY_ARTIFACT.getPath(),
/* stdout= */ null,
/* stderr= */ null,
ErrorTiming.BEFORE_EXECUTION);