| 2078 | Status MesosSchedulerDriver::start() |
| 2079 | { |
| 2080 | synchronized (mutex) { |
| 2081 | if (status != DRIVER_NOT_STARTED) { |
| 2082 | return status; |
| 2083 | } |
| 2084 | |
| 2085 | if (detector == nullptr) { |
| 2086 | Try<shared_ptr<MasterDetector>> detector_ = DetectorPool::get(url); |
| 2087 | |
| 2088 | if (detector_.isError()) { |
| 2089 | status = DRIVER_ABORTED; |
| 2090 | string message = "Failed to create a master detector for '" + |
| 2091 | master + "': " + detector_.error(); |
| 2092 | scheduler->error(this, message); |
| 2093 | return status; |
| 2094 | } |
| 2095 | |
| 2096 | // Save the detector so we can delete it later. |
| 2097 | detector = detector_.get(); |
| 2098 | } |
| 2099 | |
| 2100 | // Load scheduler flags. |
| 2101 | internal::scheduler::Flags flags; |
| 2102 | Try<flags::Warnings> load = flags.load("MESOS_"); |
| 2103 | |
| 2104 | if (load.isError()) { |
| 2105 | status = DRIVER_ABORTED; |
| 2106 | scheduler->error(this, load.error()); |
| 2107 | return status; |
| 2108 | } |
| 2109 | |
| 2110 | // Log any flag warnings. |
| 2111 | foreach (const flags::Warning& warning, load->warnings) { |
| 2112 | LOG(WARNING) << warning.message; |
| 2113 | } |
| 2114 | |
| 2115 | // Initialize modules. Note that since other subsystems may depend |
| 2116 | // upon modules, we should initialize modules before anything else. |
| 2117 | if (flags.modules.isSome() && flags.modulesDir.isSome()) { |
| 2118 | status = DRIVER_ABORTED; |
| 2119 | scheduler->error( |
| 2120 | this, |
| 2121 | "Only one of MESOS_MODULES or MESOS_MODULES_DIR should be specified"); |
| 2122 | return status; |
| 2123 | } |
| 2124 | |
| 2125 | if (flags.modulesDir.isSome()) { |
| 2126 | Try<Nothing> result = |
| 2127 | modules::ModuleManager::load(flags.modulesDir.get()); |
| 2128 | if (result.isError()) { |
| 2129 | status = DRIVER_ABORTED; |
| 2130 | scheduler->error(this, "Error loading modules: " + result.error()); |
| 2131 | return status; |
| 2132 | } |
| 2133 | } |
| 2134 | |
| 2135 | if (flags.modules.isSome()) { |
| 2136 | Try<Nothing> result = modules::ModuleManager::load(flags.modules.get()); |
| 2137 | if (result.isError()) { |
nothing calls this directly
no test coverage detected