Skip to content

Commit

Permalink
Adding the grpc health check serivce to firmament
Browse files Browse the repository at this point in the history
  • Loading branch information
shivramsrivastava committed May 7, 2018
1 parent 720ad22 commit a91d754
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/ExternalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ find_package(OpenSSL REQUIRED)
ExternalProject_Add(
protobuf3
GIT_REPOSITORY https://github.com/google/protobuf
GIT_TAG v3.1.0
GIT_TAG v3.5.1
TIMEOUT 10
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third_party/protobuf3
CONFIGURE_COMMAND "${CMAKE_COMMAND}"
Expand Down Expand Up @@ -263,4 +263,4 @@ set(grpc_LIBRARY
${grpc_SOURCE_DIR}/libgrpc++_unsecure.a
${grpc_SOURCE_DIR}/libgrpc_unsecure.a
${grpc_SOURCE_DIR}/libgpr.a)
message(${grpc_LIBRARY})
message(${grpc_LIBRARY})
16 changes: 16 additions & 0 deletions src/scheduling/firmament_scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ service FirmamentScheduler {

rpc AddTaskStats (TaskStats) returns (TaskStatsResponse) {}
rpc AddNodeStats (ResourceStats) returns (ResourceStatsResponse) {}

rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
}

message ScheduleRequest {}
Expand Down Expand Up @@ -113,3 +115,17 @@ enum NodeReplyType {
NODE_NOT_FOUND = 4;
NODE_ALREADY_EXISTS = 5;
}

enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}

message HealthCheckRequest {
string grpc_service = 1;
}

message HealthCheckResponse {
ServingStatus status = 1;
}
9 changes: 9 additions & 0 deletions src/scheduling/firmament_scheduler_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,15 @@ class FirmamentSchedulerServiceImpl final :
return Status::OK;
}

Status Check(ServerContext* context,
const HealthCheckRequest* health_service,
HealthCheckResponse* reply) override {
if (health_service->grpc_service().empty()) {
reply->set_status(ServingStatus::SERVING);
}
return Status::OK;
}

private:
SchedulerInterface* scheduler_;
SimulatedMessagingAdapter<BaseMessage>* sim_messaging_adapter_;
Expand Down

0 comments on commit a91d754

Please sign in to comment.