mesos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Rukletsov <a...@mesosphere.com>
Subject Re: Custom Mesos Allocation module
Date Tue, 26 May 2015 15:39:25 GMT
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 <dzhyrova@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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message