Search in sources :

Example 1 with ReportResultStage

use of build.buildfarm.worker.ReportResultStage in project bazel-buildfarm by bazelbuild.

the class Worker method start.

public void start() throws InterruptedException {
    try {
        Files.createDirectories(root);
        fileCache.start(/* skipLoad= */
        false);
    } catch (IOException e) {
        logger.log(SEVERE, "error starting file cache", e);
        return;
    }
    OperationQueueClient oq = new OperationQueueClient(operationQueueInstance, config.getPlatform(), config.getExecutionPoliciesList());
    Instance acInstance = newStubInstance(config.getActionCache(), casInstance.getDigestUtil());
    WorkerContext context = new OperationQueueWorkerContext(config, casInstance, acInstance, oq, uploader, fileCache, execOwner, root, retrier);
    PipelineStage completeStage = new PutOperationStage((operation) -> oq.deactivate(operation.getName()));
    PipelineStage reportResultStage = new ReportResultStage(context, completeStage, completeStage);
    PipelineStage executeActionStage = new ExecuteActionStage(context, reportResultStage, completeStage);
    PipelineStage inputFetchStage = new InputFetchStage(context, executeActionStage, new PutOperationStage(oq::requeue));
    PipelineStage matchStage = new MatchStage(context, inputFetchStage, completeStage);
    pipeline = new Pipeline();
    // pipeline.add(errorStage, 0);
    pipeline.add(matchStage, 4);
    pipeline.add(inputFetchStage, 3);
    pipeline.add(executeActionStage, 2);
    pipeline.add(reportResultStage, 1);
    pipeline.start();
    // uninterruptable
    pipeline.join();
    if (Thread.interrupted()) {
        throw new InterruptedException();
    }
    stop();
}
Also used : ExecuteActionStage(build.buildfarm.worker.ExecuteActionStage) PipelineStage(build.buildfarm.worker.PipelineStage) StubInstance(build.buildfarm.instance.stub.StubInstance) Instance(build.buildfarm.instance.Instance) InputFetchStage(build.buildfarm.worker.InputFetchStage) IOException(java.io.IOException) MatchStage(build.buildfarm.worker.MatchStage) Pipeline(build.buildfarm.worker.Pipeline) PutOperationStage(build.buildfarm.worker.PutOperationStage) WorkerContext(build.buildfarm.worker.WorkerContext) ReportResultStage(build.buildfarm.worker.ReportResultStage)

Example 2 with ReportResultStage

use of build.buildfarm.worker.ReportResultStage in project bazel-buildfarm by bazelbuild.

the class Worker method createServer.

private Server createServer(ServerBuilder<?> serverBuilder, ContentAddressableStorage storage, Instance instance, Pipeline pipeline, ShardWorkerContext context) {
    serverBuilder.addService(healthStatusManager.getHealthService());
    serverBuilder.addService(new ContentAddressableStorageService(instance, /* deadlineAfter=*/
    1, DAYS));
    serverBuilder.addService(new ByteStreamService(instance, /* writeDeadlineAfter=*/
    1, DAYS));
    serverBuilder.addService(new ShutDownWorkerGracefully(this, config));
    // storage replication.
    if (hasExecutionCapability) {
        PipelineStage completeStage = new PutOperationStage((operation) -> context.deactivate(operation.getName()));
        PipelineStage errorStage = completeStage;
        /* new ErrorStage(); */
        PipelineStage reportResultStage = new ReportResultStage(context, completeStage, errorStage);
        PipelineStage executeActionStage = new ExecuteActionStage(context, reportResultStage, errorStage);
        PipelineStage inputFetchStage = new InputFetchStage(context, executeActionStage, new PutOperationStage(context::requeue));
        PipelineStage matchStage = new MatchStage(context, inputFetchStage, errorStage);
        pipeline.add(matchStage, 4);
        pipeline.add(inputFetchStage, 3);
        pipeline.add(executeActionStage, 2);
        pipeline.add(reportResultStage, 1);
        serverBuilder.addService(new WorkerProfileService(storage, inputFetchStage, executeActionStage, context, completeStage, backplane));
    } else {
        PipelineStage casReplicationStage = new CasReplicationStage();
        pipeline.add(casReplicationStage, 1);
    }
    return serverBuilder.build();
}
Also used : ByteStreamService(build.buildfarm.server.ByteStreamService) ExecuteActionStage(build.buildfarm.worker.ExecuteActionStage) PipelineStage(build.buildfarm.worker.PipelineStage) ContentAddressableStorageService(build.buildfarm.server.ContentAddressableStorageService) InputFetchStage(build.buildfarm.worker.InputFetchStage) PutOperationStage(build.buildfarm.worker.PutOperationStage) ReportResultStage(build.buildfarm.worker.ReportResultStage) MatchStage(build.buildfarm.worker.MatchStage)

Aggregations

ExecuteActionStage (build.buildfarm.worker.ExecuteActionStage)2 InputFetchStage (build.buildfarm.worker.InputFetchStage)2 MatchStage (build.buildfarm.worker.MatchStage)2 PipelineStage (build.buildfarm.worker.PipelineStage)2 PutOperationStage (build.buildfarm.worker.PutOperationStage)2 ReportResultStage (build.buildfarm.worker.ReportResultStage)2 Instance (build.buildfarm.instance.Instance)1 StubInstance (build.buildfarm.instance.stub.StubInstance)1 ByteStreamService (build.buildfarm.server.ByteStreamService)1 ContentAddressableStorageService (build.buildfarm.server.ContentAddressableStorageService)1 Pipeline (build.buildfarm.worker.Pipeline)1 WorkerContext (build.buildfarm.worker.WorkerContext)1 IOException (java.io.IOException)1