| 147 | { |
| 148 | public: |
| 149 | MesosProcess( |
| 150 | const string& master, |
| 151 | ContentType _contentType, |
| 152 | const lambda::function<void()>& connected, |
| 153 | const lambda::function<void()>& disconnected, |
| 154 | const lambda::function<void(const queue<Event>&)>& received, |
| 155 | const Option<Credential>& _credential, |
| 156 | const Option<shared_ptr<MasterDetector>>& _detector, |
| 157 | const Flags& _flags) |
| 158 | : ProcessBase(ID::generate("scheduler")), |
| 159 | state(DISCONNECTED), |
| 160 | metrics(*this), |
| 161 | contentType(_contentType), |
| 162 | callbacks {connected, disconnected, received}, |
| 163 | credential(_credential), |
| 164 | local(false), |
| 165 | flags(_flags) |
| 166 | { |
| 167 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
| 168 | |
| 169 | // Initialize libprocess (done here since at some point we might |
| 170 | // want to use flags to initialize libprocess). |
| 171 | process::initialize(); |
| 172 | |
| 173 | if (self().address.ip.isLoopback()) { |
| 174 | LOG(WARNING) << "\n**************************************************\n" |
| 175 | << "Scheduler driver bound to loopback interface!" |
| 176 | << " Cannot communicate with remote master(s)." |
| 177 | << " You might want to set 'LIBPROCESS_IP' environment" |
| 178 | << " variable to use a routable IP address.\n" |
| 179 | << "**************************************************"; |
| 180 | } |
| 181 | |
| 182 | // Initialize logging. |
| 183 | if (flags.initialize_driver_logging) { |
| 184 | logging::initialize("mesos", false, flags); |
| 185 | } else { |
| 186 | VLOG(1) << "Disabling initialization of GLOG logging"; |
| 187 | } |
| 188 | |
| 189 | LOG(INFO) << "Version: " << MESOS_VERSION; |
| 190 | |
| 191 | // Launch a local cluster if necessary. |
| 192 | Option<UPID> pid = None(); |
| 193 | if (master == "local") { |
| 194 | pid = local::launch(flags); |
| 195 | local = true; |
| 196 | } |
| 197 | |
| 198 | if (_detector.isNone()) { |
| 199 | Try<MasterDetector*> create = |
| 200 | MasterDetector::create(pid.isSome() ? string(pid.get()) : master); |
| 201 | |
| 202 | if (create.isError()) { |
| 203 | EXIT(EXIT_FAILURE) |
| 204 | << "Failed to create a master detector: " << create.error(); |
| 205 | } |
| 206 |
nothing calls this directly
no test coverage detected