You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2016/08/28 15:04:04 UTC

[04/10] mesos git commit: Removed the health check binary.

Removed the health check binary.

With https://reviews.apache.org/r/49389/ and
https://reviews.apache.org/r/49555/, both command and
docker executors use health checks via the library. Hence
the mesos-health-check binary is not necessary anymore.

Review: https://reviews.apache.org/r/49556/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f19a6aa0
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f19a6aa0
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f19a6aa0

Branch: refs/heads/master
Commit: f19a6aa07d418b7469745248b5b1c23ccf155615
Parents: c09bb37
Author: haosdent huang <ha...@gmail.com>
Authored: Fri Aug 26 16:32:58 2016 +0200
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Sun Aug 28 16:31:55 2016 +0200

----------------------------------------------------------------------
 src/CMakeLists.txt              |   1 -
 src/Makefile.am                 |   5 -
 src/health-check/CMakeLists.txt |  46 ---------
 src/health-check/main.cpp       | 176 -----------------------------------
 4 files changed, 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f19a6aa0/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ccd9892..b14132a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -516,7 +516,6 @@ target_link_libraries(${MESOS_PROTOBUF_TARGET} ${AGENT_LIBS})
 ##############################
 add_subdirectory(cli/)
 add_subdirectory(docker/)
-add_subdirectory(health-check/)
 add_subdirectory(launcher/)
 add_subdirectory(local/)
 add_subdirectory(master/)

http://git-wip-us.apache.org/repos/asf/mesos/blob/f19a6aa0/src/Makefile.am
----------------------------------------------------------------------
diff --git a/src/Makefile.am b/src/Makefile.am
index b577b42..a307482 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1356,11 +1356,6 @@ mesos_network_helper_CPPFLAGS = $(MESOS_CPPFLAGS)
 mesos_network_helper_LDADD = libmesos.la $(LDADD)
 endif
 
-pkglibexec_PROGRAMS += mesos-health-check
-mesos_health_check_SOURCES = health-check/main.cpp
-mesos_health_check_CPPFLAGS = $(MESOS_CPPFLAGS)
-mesos_health_check_LDADD = libmesos.la $(LDADD)
-
 pkglibexec_PROGRAMS += mesos-usage
 mesos_usage_SOURCES = usage/main.cpp
 mesos_usage_CPPFLAGS = $(MESOS_CPPFLAGS)

http://git-wip-us.apache.org/repos/asf/mesos/blob/f19a6aa0/src/health-check/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/health-check/CMakeLists.txt b/src/health-check/CMakeLists.txt
deleted file mode 100644
index 69e9566..0000000
--- a/src/health-check/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# MESOS HEALTH SOURCE.
-######################
-set(HEALTH_EXECUTABLE_SRC
-  ${HEALTH_EXECUTABLE_SRC}
-  main.cpp
-  )
-
-# INCLUDE DIRECTIVES FOR MESOS HEALTH CHECK EXECUTABLE (generates, e.g.,
-# -I/path/to/thing on Linux).
-########################################################################
-include_directories(${AGENT_INCLUDE_DIRS})
-
-# LINKING LIBRARIES BY DIRECTORY (might generate, e.g., -L/path/to/thing on
-# Linux).
-###########################################################################
-link_directories(${AGENT_LIB_DIRS})
-
-# THE MESOS HELATH CHECK EXECUTABLE.
-####################################
-add_executable(${MESOS_HEALTH_CHECK} ${HEALTH_EXECUTABLE_SRC})
-
-# ADD LINKER FLAGS (generates, e.g., -lglog on Linux).
-######################################################
-target_link_libraries(${MESOS_HEALTH_CHECK} ${AGENT_LIBS} ${MESOS_TARGET})
-
-
-# ADD BINARY DEPENDENCIES (tells CMake what to compile/build first).
-####################################################################
-add_dependencies(${MESOS_HEALTH_CHECK} ${MESOS_TARGET})

http://git-wip-us.apache.org/repos/asf/mesos/blob/f19a6aa0/src/health-check/main.cpp
----------------------------------------------------------------------
diff --git a/src/health-check/main.cpp b/src/health-check/main.cpp
deleted file mode 100644
index 5346e30..0000000
--- a/src/health-check/main.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef __WINDOWS__
-#include <unistd.h>
-#endif // __WINDOWS__
-
-#include <iostream>
-#include <string>
-
-#include <mesos/mesos.hpp>
-
-#include <process/future.hpp>
-#include <process/pid.hpp>
-#include <process/process.hpp>
-#include <process/protobuf.hpp>
-
-#include <stout/flags.hpp>
-#include <stout/json.hpp>
-#include <stout/option.hpp>
-#include <stout/path.hpp>
-#include <stout/protobuf.hpp>
-
-#include "health-check/health_checker.hpp"
-
-using namespace mesos;
-
-using std::cout;
-using std::cerr;
-using std::endl;
-using std::string;
-
-using process::UPID;
-
-class Flags : public virtual flags::FlagsBase
-{
-public:
-  Flags()
-  {
-    add(&Flags::health_check_json,
-        "health_check_json",
-        "JSON describing health check to perform");
-
-    add(&Flags::executor,
-        "executor",
-        "Executor UPID to send health check messages to");
-
-    add(&Flags::task_id,
-        "task_id",
-        "Task ID that this health check process is checking");
-  }
-
-  Option<string> health_check_json;
-  Option<UPID> executor;
-  Option<string> task_id;
-};
-
-
-void usage(const char* argv0, const flags::FlagsBase& flags)
-{
-  cerr << "Usage: " << Path(argv0).basename() << " [...]" << endl
-       << endl
-       << "Supported options:" << endl
-       << flags.usage();
-}
-
-
-int main(int argc, char** argv)
-{
-  GOOGLE_PROTOBUF_VERIFY_VERSION;
-
-  Flags flags;
-
-  Try<flags::Warnings> load = flags.load(None(), argc, argv);
-
-  if (load.isError()) {
-    cerr << flags.usage(load.error()) << endl;
-    return EXIT_FAILURE;
-  }
-
-  if (flags.help) {
-    cout << flags.usage() << endl;
-    return EXIT_SUCCESS;
-  }
-
-  // Log any flag warnings.
-  foreach (const flags::Warning& warning, load->warnings) {
-    LOG(WARNING) << warning.message;
-  }
-
-  if (flags.health_check_json.isNone()) {
-    cerr << flags.usage("Expected JSON with health check description") << endl;
-    return EXIT_FAILURE;
-  }
-
-  Try<JSON::Object> parse =
-    JSON::parse<JSON::Object>(flags.health_check_json.get());
-
-  if (parse.isError()) {
-    cerr << flags.usage("Failed to parse --health_check_json: " + parse.error())
-         << endl;
-    return EXIT_FAILURE;
-  }
-
-  Try<HealthCheck> check = protobuf::parse<HealthCheck>(parse.get());
-
-  if (check.isError()) {
-    cerr << flags.usage("Failed to parse --health_check_json: " + check.error())
-         << endl;
-    return EXIT_SUCCESS;
-  }
-
-  if (flags.executor.isNone()) {
-    cerr << flags.usage("Missing required option --executor") << endl;
-    return EXIT_FAILURE;
-  }
-
-  if (check.get().has_http() && check.get().has_command()) {
-    cerr << flags.usage("Both 'http' and 'command' health check requested")
-         << endl;
-    return EXIT_FAILURE;
-  }
-
-  if (!check.get().has_http() && !check.get().has_command()) {
-    cerr << flags.usage("Expecting one of 'http' or 'command' health check")
-         << endl;
-    return EXIT_FAILURE;
-  }
-
-  if (flags.task_id.isNone()) {
-    cerr << flags.usage("Missing required option --task_id") << endl;
-    return EXIT_FAILURE;
-  }
-
-  TaskID taskID;
-  taskID.set_value(flags.task_id.get());
-
-  mesos::internal::health::HealthCheckerProcess process(
-    check.get(),
-    flags.executor.get(),
-    taskID);
-
-  process::spawn(&process);
-
-  process::Future<Nothing> checking =
-    process::dispatch(
-      process, &mesos::internal::health::HealthCheckerProcess::healthCheck);
-
-  checking.await();
-
-  process::terminate(process);
-  process::wait(process);
-
-  if (checking.isFailed()) {
-    LOG(WARNING) << "Health check failed " << checking.failure();
-    return EXIT_FAILURE;
-  }
-
-  return EXIT_SUCCESS;
-}