Search in sources :

Example 1 with ExecuteServiceBlockingStub

use of com.google.devtools.build.lib.remote.ExecuteServiceGrpc.ExecuteServiceBlockingStub in project bazel by bazelbuild.

the class RemoteWorkExecutor method executeRemotely.

public ExecuteReply executeRemotely(ExecuteRequest request) {
    ExecuteServiceBlockingStub stub = ExecuteServiceGrpc.newBlockingStub(channel).withDeadlineAfter(options.grpcTimeoutSeconds + request.getTimeoutMillis() / 1000, TimeUnit.SECONDS);
    Iterator<ExecuteReply> replies = stub.execute(request);
    ExecuteReply reply = null;
    while (replies.hasNext()) {
        reply = replies.next();
    // We can handle the action execution progress here.
    }
    if (reply == null) {
        return ExecuteReply.newBuilder().setStatus(ExecutionStatus.newBuilder().setExecuted(false).setSucceeded(false).setError(ExecutionStatus.ErrorCode.UNKNOWN_ERROR).setErrorDetail("Remote server terminated the connection")).build();
    }
    return reply;
}
Also used : ExecuteServiceBlockingStub(com.google.devtools.build.lib.remote.ExecuteServiceGrpc.ExecuteServiceBlockingStub) ExecuteReply(com.google.devtools.build.lib.remote.RemoteProtocol.ExecuteReply)

Aggregations

ExecuteServiceBlockingStub (com.google.devtools.build.lib.remote.ExecuteServiceGrpc.ExecuteServiceBlockingStub)1 ExecuteReply (com.google.devtools.build.lib.remote.RemoteProtocol.ExecuteReply)1