use of build.buildfarm.worker.Pipeline 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();
}
Aggregations