| 10062 | |
| 10063 | |
| 10064 | void Slave::initializeResourceProviderManager( |
| 10065 | const Flags& flags, |
| 10066 | const SlaveID& slaveId) |
| 10067 | { |
| 10068 | // To simplify reasoning about lifetimes we do not allow |
| 10069 | // reinitialization of the resource provider manager. |
| 10070 | if (resourceProviderManager.get() != nullptr) { |
| 10071 | return; |
| 10072 | } |
| 10073 | |
| 10074 | // The registrar uses LevelDB as underlying storage. Since LevelDB |
| 10075 | // is currently not supported on Windows (see MESOS-5932), we fall |
| 10076 | // back to in-memory storage there. |
| 10077 | // |
| 10078 | // TODO(bbannier): Remove this Windows workaround once MESOS-5932 is fixed. |
| 10079 | #ifndef __WINDOWS__ |
| 10080 | Owned<mesos::state::Storage> storage(new mesos::state::LevelDBStorage( |
| 10081 | paths::getResourceProviderRegistryPath(flags.work_dir, slaveId))); |
| 10082 | #else |
| 10083 | LOG(WARNING) |
| 10084 | << "Persisting resource provider manager state is not supported on Windows"; |
| 10085 | Owned<mesos::state::Storage> storage(new mesos::state::InMemoryStorage()); |
| 10086 | #endif // __WINDOWS__ |
| 10087 | |
| 10088 | Try<Owned<resource_provider::Registrar>> resourceProviderRegistrar = |
| 10089 | resource_provider::Registrar::create(std::move(storage)); |
| 10090 | |
| 10091 | CHECK_SOME(resourceProviderRegistrar) |
| 10092 | << "Could not construct resource provider registrar: " |
| 10093 | << resourceProviderRegistrar.error(); |
| 10094 | |
| 10095 | resourceProviderManager.reset( |
| 10096 | new ResourceProviderManager(std::move(resourceProviderRegistrar.get()))); |
| 10097 | |
| 10098 | if (capabilities.resourceProvider) { |
| 10099 | // Start listening for messages from the resource provider manager. |
| 10100 | resourceProviderManager->messages().get().onAny( |
| 10101 | defer(self(), &Self::handleResourceProviderMessage, lambda::_1)); |
| 10102 | } |
| 10103 | } |
| 10104 | |
| 10105 | |
| 10106 | google::protobuf::Map<string, Value::Scalar> Slave::computeExecutorLimits( |