Dariia, I'm excited to see people hacking on allocation algorithms in Mesos! May I ask you to share some information about what custom allocation policy do you use? What is the motivation?
Thanks, Alex On Wed, May 27, 2015 at 8:32 PM, Dariia Zhyrova <dzhyr...@cogniance.com> wrote: > Thank you very much! I used an old Mesos version indeed. Using custom > allocator module works just fine. > Best reagrds, > Dariia > > On Tue, May 26, 2015 at 6:39 PM, Alex Rukletsov <a...@mesosphere.com> > wrote: > > > Dariia, > > > > what Mesos version are you using? The ability to write and and use custom > > allocator modules without hacking on Mesos source code has just landed in > > Mesos (means will be available in 0.23 release) with docs being updated > > right now (here <https://reviews.apache.org/r/34545/> is the RR request > if > > you really want to be on the bleeding edge). > > > > However, if you're on an older version of Mesos, you can still write your > > own module and replace / adjust the line you refer to in master/main.cpp > to > > support your custom allocator. > > > > On Mon, May 25, 2015 at 1:18 PM, Dariia Zhyrova <dzhyr...@cogniance.com> > > wrote: > > > > > Hello, > > > > > > I need to write custom Allocation module, but I don't see a possibility > > to > > > load it dynamically using --modules command line argument. > > > This is the allocation module creation in master/main: > > > > > > allocator::Allocator* allocator = new > > > allocator::HierarchicalDRFAllocator(); > > > > > > (so it is just hardcoded) > > > Other modules are loaded dynamically like this: > > > > > > if (flags.modules.isSome()) { > > > Try<Nothing> result = ModuleManager::load(flags.modules.get()); > > > if (result.isError()) { > > > EXIT(1) << "Error loading modules: " << result.error(); > > > } > > > } > > > ... > > > // Create anonymous modules. > > > foreach (const string& name, ModuleManager::find<Anonymous>()) { > > > Try<Anonymous*> create = ModuleManager::create<Anonymous>(name); > > > if (create.isError()) { > > > EXIT(1) << "Failed to create anonymous module named '" << name << > > > "'"; > > > } > > > ... > > > Authenticator* authenticator; > > > // TODO(tillt): Allow multiple authenticators to be loaded and enable > > > // the authenticatee to select the appropriate one. See MESOS-1939. > > > if (authenticatorNames[0] == DEFAULT_AUTHENTICATOR) { > > > LOG(INFO) << "Using default CRAM-MD5 authenticator"; > > > authenticator = new cram_md5::CRAMMD5Authenticator(); > > > } else { > > > Try<Authenticator*> module = > > > > > modules::ModuleManager::create<Authenticator>(authenticatorNames[0]); > > > if (module.isError()) { > > > EXIT(1) << "Could not create authenticator module '" > > > << authenticatorNames[0] << "': " << module.error(); > > > } > > > ... > > > if (ModuleManager::contains<Isolator>(type)) { > > > Try<Isolator*> isolator = ModuleManager::create<Isolator>(type); > > > if (isolator.isError()) { > > > return Error( > > > "Could not create isolator " + type + ": " + > > isolator.error()); > > > } > > > > > > This is a list of supported modules which can be loaded dynamically: > > > kindToVersion["Anonymous"] = MESOS_VERSION; > > > kindToVersion["Authenticatee"] = MESOS_VERSION; > > > kindToVersion["Authenticator"] = MESOS_VERSION; > > > kindToVersion["Hook"] = MESOS_VERSION; > > > kindToVersion["Isolator"] = MESOS_VERSION; > > > kindToVersion["TestModule"] = MESOS_VERSION; > > > > > > If allocation module is absent here, it will not pass such check: > > > > > > Try<Nothing> ModuleManager::verifyModule( > > > const string& moduleName, > > > const ModuleBase* moduleBase) > > > { > > > ... > > > if (!kindToVersion.contains(moduleBase->kind)) { > > > return Error("Unknown module kind: " + > stringify(moduleBase->kind)); > > > } > > > ... > > > } > > > > > > Mesos documentation also does not mention Allocation module as > > dynamically > > > loadable: http://mesos.apache.org/documentation/latest/modules/ > > > > > > Could you please help me, is there a possibility to use custom > allocation > > > module with Mesos? > > > > > > Best regards, > > > Dariia > > > > > >