Search in sources :

Example 1 with ActionMiddlemanEvent

use of com.google.devtools.build.lib.actions.ActionMiddlemanEvent in project bazel by bazelbuild.

the class SkyframeActionExecutor method checkActionCache.

/**
   * Checks the action cache to see if {@code action} needs to be executed, or is up to date.
   * Returns a token with the semantics of {@link ActionCacheChecker#getTokenIfNeedToExecute}: null
   * if the action is up to date, and non-null if it needs to be executed, in which case that token
   * should be provided to the ActionCacheChecker after execution.
   */
Token checkActionCache(Action action, MetadataHandler metadataHandler, long actionStartTime, Iterable<Artifact> resolvedCacheArtifacts, Map<String, String> clientEnv) {
    profiler.startTask(ProfilerTask.ACTION_CHECK, action);
    Token token = actionCacheChecker.getTokenIfNeedToExecute(action, resolvedCacheArtifacts, clientEnv, explain ? reporter : null, metadataHandler);
    profiler.completeTask(ProfilerTask.ACTION_CHECK);
    if (token == null) {
        boolean eventPosted = false;
        // Notify BlazeRuntimeStatistics about the action middleman 'execution'.
        if (action.getActionType().isMiddleman()) {
            postEvent(new ActionMiddlemanEvent(action, actionStartTime));
            eventPosted = true;
        }
        if (action instanceof NotifyOnActionCacheHit) {
            NotifyOnActionCacheHit notify = (NotifyOnActionCacheHit) action;
            notify.actionCacheHit(executorEngine);
        }
        // We still need to check the outputs so that output file data is available to the value.
        checkOutputs(action, metadataHandler);
        if (!eventPosted) {
            postEvent(new CachedActionEvent(action, actionStartTime));
        }
    }
    return token;
}
Also used : CachedActionEvent(com.google.devtools.build.lib.actions.CachedActionEvent) NotifyOnActionCacheHit(com.google.devtools.build.lib.actions.NotifyOnActionCacheHit) Token(com.google.devtools.build.lib.actions.ActionCacheChecker.Token) ActionMiddlemanEvent(com.google.devtools.build.lib.actions.ActionMiddlemanEvent)

Aggregations

Token (com.google.devtools.build.lib.actions.ActionCacheChecker.Token)1 ActionMiddlemanEvent (com.google.devtools.build.lib.actions.ActionMiddlemanEvent)1 CachedActionEvent (com.google.devtools.build.lib.actions.CachedActionEvent)1 NotifyOnActionCacheHit (com.google.devtools.build.lib.actions.NotifyOnActionCacheHit)1