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

Method initialize

src/sched/sched.cpp:1832–1898  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1830
1831
1832void MesosSchedulerDriver::initialize() {
1833 GOOGLE_PROTOBUF_VERIFY_VERSION;
1834
1835 // Load any flags from the environment (we use local::Flags in the
1836 // event we run in 'local' mode, since it inherits logging::Flags).
1837 // In the future, just as the TODO in local/main.cpp discusses,
1838 // we'll probably want a way to load master::Flags and slave::Flags
1839 // as well.
1840 local::Flags flags;
1841 Try<flags::Warnings> load = flags.load("MESOS_");
1842
1843 if (load.isError()) {
1844 status = DRIVER_ABORTED;
1845 scheduler->error(this, load.error());
1846 return;
1847 }
1848
1849 // Initialize libprocess. NOTE: We need to ensure this happens
1850 // before we invoke anything in libprocess. While libprocess will
1851 // call `process::initialize` internally if needed, it will do so
1852 // without passing any parameters; any subsequent calls to
1853 // `process::initialize` (with non-empty arguments) will be ignored.
1854 process::initialize(schedulerId);
1855
1856 if (process::address().ip.isLoopback()) {
1857 LOG(WARNING) << "\n**************************************************\n"
1858 << "Scheduler driver bound to loopback interface!"
1859 << " Cannot communicate with remote master(s)."
1860 << " You might want to set 'LIBPROCESS_IP' environment"
1861 << " variable to use a routable IP address.\n"
1862 << "**************************************************";
1863 }
1864
1865 // Initialize logging.
1866 // TODO(benh): Replace whitespace in framework.name() with '_'?
1867 if (flags.initialize_driver_logging) {
1868 logging::initialize(framework.name(), false, flags);
1869 } else {
1870 VLOG(1) << "Disabling initialization of GLOG logging";
1871 }
1872
1873 // Log any flag warnings (after logging is initialized).
1874 foreach (const flags::Warning& warning, load->warnings) {
1875 LOG(WARNING) << warning.message;
1876 }
1877
1878 spawn(new VersionProcess(), true);
1879
1880 // Initialize Latch.
1881 latch = new Latch();
1882
1883 // TODO(benh): Check the user the framework wants to run tasks as,
1884 // see if the current user can switch to that user, or via an
1885 // authentication module ensure this is acceptable.
1886
1887 fillMissingFrameworkInfoFields(&framework);
1888
1889 // Launch a local cluster if necessary.

Callers

nothing calls this directly

Calls 12

isLoopbackMethod · 0.80
errorMethod · 0.65
initializeFunction · 0.50
addressFunction · 0.50
spawnFunction · 0.50
launchFunction · 0.50
loadMethod · 0.45
isErrorMethod · 0.45
nameMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected