Skip to content

Commit

Permalink
Automated rollback of commit 14f8b10.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

b/119318671: ActionRunner holds onto much more memory than FutureTask<ActionExecutionValue>.

*** Original change description ***

Refactor SkyframeActionExecutor

- avoid FutureTask; make ActionRunner self-contained
- reorganize the prepare/execute/complete flow

This is in preparation for making actions async, which requires that
ActionRunner itself becomes async, which in turn precludes the use of
FutureTask and also requires that the code flow more cleanly separates
pre-execution and post-execution steps.

PiperOrigin-RevId: 220866469
  • Loading branch information
janakdr authored and Copybara-Service committed Nov 9, 2018
1 parent 14c0f40 commit 68fc46b
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 189 deletions.
Expand Up @@ -49,6 +49,7 @@ public final class ActionExecutionStatusReporter {
private static final int MAX_LINES = 10;

private final EventHandler eventHandler;
private final Executor executor;
private final EventBus eventBus;
private final Clock clock;

Expand All @@ -64,29 +65,29 @@ public static ActionExecutionStatusReporter create(EventHandler eventHandler) {
}

@VisibleForTesting
static ActionExecutionStatusReporter create(EventHandler eventHandler, @Nullable Clock clock) {
return create(eventHandler, null, clock);
static ActionExecutionStatusReporter create(EventHandler eventHandler, Clock clock) {
return create(eventHandler, null, null, clock);
}

public static ActionExecutionStatusReporter create(
EventHandler eventHandler, @Nullable EventBus eventBus) {
return create(eventHandler, eventBus, null);
public static ActionExecutionStatusReporter create(EventHandler eventHandler,
@Nullable Executor executor, @Nullable EventBus eventBus) {
return create(eventHandler, executor, eventBus, null);
}

private static ActionExecutionStatusReporter create(
EventHandler eventHandler, @Nullable EventBus eventBus, @Nullable Clock clock) {
ActionExecutionStatusReporter result =
new ActionExecutionStatusReporter(
eventHandler, eventBus, clock == null ? BlazeClock.instance() : clock);
private static ActionExecutionStatusReporter create(EventHandler eventHandler,
@Nullable Executor executor, @Nullable EventBus eventBus, @Nullable Clock clock) {
ActionExecutionStatusReporter result = new ActionExecutionStatusReporter(eventHandler, executor,
eventBus, clock == null ? BlazeClock.instance() : clock);
if (eventBus != null) {
eventBus.register(result);
}
return result;
}

private ActionExecutionStatusReporter(
EventHandler eventHandler, @Nullable EventBus eventBus, Clock clock) {
private ActionExecutionStatusReporter(EventHandler eventHandler, @Nullable Executor executor,
@Nullable EventBus eventBus, Clock clock) {
this.eventHandler = Preconditions.checkNotNull(eventHandler);
this.executor = executor;
this.eventBus = eventBus;
this.clock = Preconditions.checkNotNull(clock);
}
Expand All @@ -108,6 +109,13 @@ public void remove(Action action) {
Preconditions.checkNotNull(actionStatus.remove(action), action);
}

/**
* Set "Preparing" status.
*/
public void setPreparing(Action action) {
updateStatus(ActionStatusMessage.preparingStrategy(action));
}

@Subscribe
public void updateStatus(ActionStatusMessage statusMsg) {
String message = statusMsg.getMessage();
Expand Down
Expand Up @@ -127,8 +127,8 @@ public void buildArtifacts(
List<ExitCode> exitCodes = new LinkedList<>();
EvaluationResult<?> result;

ActionExecutionStatusReporter statusReporter =
ActionExecutionStatusReporter.create(reporter, skyframeExecutor.getEventBus());
ActionExecutionStatusReporter statusReporter = ActionExecutionStatusReporter.create(
reporter, executor, skyframeExecutor.getEventBus());

AtomicBoolean isBuildingExclusiveArtifacts = new AtomicBoolean(false);
ActionExecutionInactivityWatchdog watchdog =
Expand Down

0 comments on commit 68fc46b

Please sign in to comment.