Search in sources :

Example 1 with StoreBuildGraphRequest

use of com.facebook.buck.distributed.thrift.StoreBuildGraphRequest in project buck by facebook.

the class DistBuildService method uploadTargetGraph.

public ListenableFuture<Void> uploadTargetGraph(final BuildJobState buildJobStateArg, final StampedeId stampedeId, ListeningExecutorService executorService) {
    // TODO(shivanker): We shouldn't be doing this. Fix after we stop reading all files into memory.
    final BuildJobState buildJobState = buildJobStateArg.deepCopy();
    return executorService.submit(() -> {
        // Get rid of file contents from buildJobState
        for (BuildJobStateFileHashes cell : buildJobState.getFileHashes()) {
            if (!cell.isSetEntries()) {
                continue;
            }
            for (BuildJobStateFileHashEntry file : cell.getEntries()) {
                file.unsetContents();
            }
        }
        // Now serialize and send the whole buildJobState
        StoreBuildGraphRequest storeBuildGraphRequest = new StoreBuildGraphRequest();
        storeBuildGraphRequest.setStampedeId(stampedeId);
        storeBuildGraphRequest.setBuildGraph(BuildJobStateSerializer.serialize(buildJobState));
        FrontendRequest request = new FrontendRequest();
        request.setType(FrontendRequestType.STORE_BUILD_GRAPH);
        request.setStoreBuildGraphRequest(storeBuildGraphRequest);
        makeRequestChecked(request);
        // No response expected.
        return null;
    });
}
Also used : BuildJobStateFileHashEntry(com.facebook.buck.distributed.thrift.BuildJobStateFileHashEntry) BuildJobStateFileHashes(com.facebook.buck.distributed.thrift.BuildJobStateFileHashes) StoreBuildGraphRequest(com.facebook.buck.distributed.thrift.StoreBuildGraphRequest) BuildJobState(com.facebook.buck.distributed.thrift.BuildJobState) FrontendRequest(com.facebook.buck.distributed.thrift.FrontendRequest)

Aggregations

BuildJobState (com.facebook.buck.distributed.thrift.BuildJobState)1 BuildJobStateFileHashEntry (com.facebook.buck.distributed.thrift.BuildJobStateFileHashEntry)1 BuildJobStateFileHashes (com.facebook.buck.distributed.thrift.BuildJobStateFileHashes)1 FrontendRequest (com.facebook.buck.distributed.thrift.FrontendRequest)1 StoreBuildGraphRequest (com.facebook.buck.distributed.thrift.StoreBuildGraphRequest)1