Search in sources :

Example 1 with GetClientStartTimeRequest

use of build.buildfarm.v1test.GetClientStartTimeRequest in project bazel-buildfarm by bazelbuild.

the class AdminServiceImpl method getAllContainersUptime.

private Map<String, Long> getAllContainersUptime(List<String> hostNames) {
    ManagedChannel channel = ManagedChannelBuilder.forAddress(deploymentDomain, deploymentPort).usePlaintext().build();
    AdminGrpc.AdminBlockingStub stub = AdminGrpc.newBlockingStub(channel);
    GetClientStartTimeRequest request = GetClientStartTimeRequest.newBuilder().setInstanceName("shard").addAllHostName(hostNames).build();
    GetClientStartTimeResult result = stub.getClientStartTime(request);
    Map<String, Long> allContainersUptime = new HashMap<String, Long>();
    for (GetClientStartTime GetClientStartTime : result.getClientStartTimeList()) {
        allContainersUptime.put(GetClientStartTime.getInstanceName(), GetClientStartTime.getClientStartTime().getSeconds());
    }
    if (channel != null) {
        channel.shutdown();
    }
    return allContainersUptime;
}
Also used : AdminGrpc(build.buildfarm.v1test.AdminGrpc) HashMap(java.util.HashMap) GetClientStartTime(build.buildfarm.v1test.GetClientStartTime) ManagedChannel(io.grpc.ManagedChannel) GetClientStartTimeRequest(build.buildfarm.v1test.GetClientStartTimeRequest) GetClientStartTimeResult(build.buildfarm.v1test.GetClientStartTimeResult)

Aggregations

AdminGrpc (build.buildfarm.v1test.AdminGrpc)1 GetClientStartTime (build.buildfarm.v1test.GetClientStartTime)1 GetClientStartTimeRequest (build.buildfarm.v1test.GetClientStartTimeRequest)1 GetClientStartTimeResult (build.buildfarm.v1test.GetClientStartTimeResult)1 ManagedChannel (io.grpc.ManagedChannel)1 HashMap (java.util.HashMap)1