use of build.bazel.remote.execution.v2.ExecutionGrpc.ExecutionStub in project bazel-buildfarm by bazelbuild.
the class Executor method executeActions.
static void executeActions(String instanceName, List<Digest> actionDigests, ExecutionStub execStub) throws InterruptedException {
ScheduledExecutorService service = newSingleThreadScheduledExecutor();
AtomicInteger[] statusCounts = new AtomicInteger[18];
for (int i = 0; i < statusCounts.length; i++) {
statusCounts[i] = new AtomicInteger(0);
}
AtomicLong countdown = new AtomicLong(actionDigests.size());
for (Digest actionDigest : actionDigests) {
ExecutionObserver executionObserver = new ExecutionObserver(countdown, statusCounts, execStub, instanceName, actionDigest, service);
executionObserver.execute();
MICROSECONDS.sleep(1);
}
while (countdown.get() != 0) {
SECONDS.sleep(1);
}
for (int i = 0; i < statusCounts.length; i++) {
AtomicInteger statusCount = statusCounts[i];
if (statusCount.get() != 0) {
System.out.println("Status " + Code.forNumber(i) + " : " + statusCount.get() + " responses");
}
}
shutdownAndAwaitTermination(service, 1, SECONDS);
}
use of build.bazel.remote.execution.v2.ExecutionGrpc.ExecutionStub in project bazel-buildfarm by bazelbuild.
the class Executor method main.
public static void main(String[] args) throws Exception {
String host = args[0];
String instanceName = args[1];
String blobsDir;
if (args.length == 3) {
blobsDir = args[2];
} else {
blobsDir = null;
}
Scanner scanner = new Scanner(System.in);
ImmutableList.Builder<Digest> actionDigests = ImmutableList.builder();
while (scanner.hasNext()) {
actionDigests.add(DigestUtil.parseDigest(scanner.nextLine()));
}
ManagedChannel channel = createChannel(host);
if (blobsDir != null) {
System.out.println("Loading blobs into cas");
loadFilesIntoCAS(instanceName, channel, Paths.get(blobsDir));
}
ExecutionStub execStub = ExecutionGrpc.newStub(channel);
executeActions(instanceName, actionDigests.build(), execStub);
channel.shutdown();
channel.awaitTermination(1, SECONDS);
}
Aggregations