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

Function launch

src/local/local.cpp:172–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171
172PID<Master> launch(const Flags& flags, Allocator* _allocator)
173{
174 if (master != nullptr) {
175 LOG(FATAL) << "Can only launch one local cluster at a time (for now)";
176 }
177
178 if (_allocator == nullptr) {
179 // Create a default allocator.
180 Try<Allocator*> defaultAllocator = HierarchicalDRFAllocator::create();
181 if (defaultAllocator.isError()) {
182 EXIT(EXIT_FAILURE)
183 << "Failed to create an instance of HierarchicalDRFAllocator: "
184 << defaultAllocator.error();
185 }
186
187 // Update caller's instance.
188 _allocator = defaultAllocator.get();
189
190 // Save the instance for deleting later.
191 allocator = defaultAllocator.get();
192 } else {
193 // TODO(benh): Figure out the behavior of allocator pointer and
194 // remove the else block.
195 allocator = nullptr;
196 }
197
198 files = new Files();
199
200 {
201 // Use to propagate necessary flags to master. Without this, the
202 // load call will spit out an error unless their corresponding
203 // environment variables explicitly set.
204 map<string, string> propagatedFlags;
205 propagatedFlags["work_dir"] = path::join(flags.work_dir, "master");
206
207 master::Flags masterFlags;
208 Try<flags::Warnings> load = masterFlags.load(
209 propagatedFlags,
210 false,
211 "MESOS_");
212
213 if (load.isError()) {
214 EXIT(EXIT_FAILURE)
215 << "Failed to start a local cluster while loading"
216 << " master flags from the environment: " << load.error();
217 }
218
219 // Log any flag warnings.
220 foreach (const flags::Warning& warning, load->warnings) {
221 LOG(WARNING) << warning.message;
222 }
223
224 // Attempt to create the `work_dir` for master as a convenience.
225 Try<Nothing> mkdir = os::mkdir(masterFlags.work_dir.get());
226 if (mkdir.isError()) {
227 EXIT(EXIT_FAILURE)
228 << "Failed to create the work_dir for master '"
229 << masterFlags.work_dir.get() << "': " << mkdir.error();

Callers 15

mainFunction · 0.70
MesosProcessMethod · 0.50
initializeMethod · 0.50
foreachpairFunction · 0.50
addMethod · 0.50
updateMethod · 0.50
receivedMethod · 0.50
initializeMethod · 0.50
_launchMethod · 0.50
TEST_FFunction · 0.50
TEST_PFunction · 0.50
TEST_PFunction · 0.50

Calls 15

loadFunction · 0.85
splitFunction · 0.85
NoneClass · 0.85
tokenizeFunction · 0.85
permissionsFunction · 0.85
generateFunction · 0.85
infoMethod · 0.80
errorMethod · 0.65
createFunction · 0.50
joinFunction · 0.50
mkdirFunction · 0.50
parseFunction · 0.50

Tested by 15

initializeMethod · 0.40
_launchMethod · 0.40
TEST_FFunction · 0.40
TEST_PFunction · 0.40
TEST_PFunction · 0.40
TEST_FFunction · 0.40
TEST_PFunction · 0.40
TEST_FFunction · 0.40
TYPED_TESTFunction · 0.40
TEST_FFunction · 0.40