MCPcopy Create free account
hub / github.com/apache/mesos / launchHealthCheck

Method launchHealthCheck

src/docker/executor.cpp:794–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792 }
793
794 void launchHealthCheck(const string& containerName, const TaskInfo& task)
795 {
796 // Bail out early if we have been already killed or if the task has no
797 // associated health checks.
798 //
799 // TODO(alexr): Consider starting health checks even if we have
800 // already been killed to ensure that tasks are health checked
801 // while in their kill grace period.
802 if (killed || !task.has_health_check()) {
803 return;
804 }
805
806 HealthCheck healthCheck = task.health_check();
807
808 vector<string> namespaces;
809 if (healthCheck.type() == HealthCheck::HTTP ||
810 healthCheck.type() == HealthCheck::TCP) {
811 // Make sure HTTP and TCP health checks are run
812 // from the container's network namespace.
813 namespaces.push_back("net");
814 }
815
816 const checks::runtime::Docker dockerRuntime{
817 namespaces,
818 containerPid,
819 docker->getPath(),
820 docker->getSocket(),
821 containerName
822 };
823
824 Try<Owned<checks::HealthChecker>> _checker =
825 checks::HealthChecker::create(
826 healthCheck,
827 launcherDir,
828 defer(self(), &Self::taskHealthUpdated, lambda::_1),
829 task.task_id(),
830 dockerRuntime);
831
832 if (_checker.isError()) {
833 // TODO(gilbert): Consider ABORT and return a TASK_FAILED here.
834 LOG(ERROR) << "Failed to create health checker: "
835 << _checker.error();
836 } else {
837 checker = _checker.get();
838 }
839 }
840
841 // TODO(alexr): Introduce a state enum and document transitions,
842 // see MESOS-5252.

Callers

nothing calls this directly

Calls 8

deferFunction · 0.85
typeMethod · 0.80
getSocketMethod · 0.80
errorMethod · 0.65
createFunction · 0.50
getPathMethod · 0.45
isErrorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected