bool operator==(const SlaveInfo& left, const SlaveInfo& right) { return left.hostname() == right.hostname() && Resources(left.resources()) == Resources(right.resources()) && Attributes(left.attributes()) == Attributes(right.attributes()) && left.id() == right.id() && left.checkpoint() == right.checkpoint() && left.port() == right.port(); }
inline bool operator == (const SlaveInfo& left, const SlaveInfo& right) { return left.hostname() == right.hostname() && left.webui_hostname() == right.webui_hostname() && Resources(left.resources()) == Resources(right.resources()) && internal::Attributes(left.attributes()) == internal::Attributes(right.attributes()) && left.has_webui_port() == right.has_webui_port() && (!left.has_webui_port() || (left.webui_port() == right.webui_port())) && left.has_id() == right.has_id() && (!left.has_id() || (left.id() == right.id())) && left.has_checkpoint() == right.has_checkpoint() && (!left.has_checkpoint() || (left.checkpoint() == right.checkpoint())); }
virtual Result<Resources> slaveResourcesDecorator( const SlaveInfo& slaveInfo) { LOG(INFO) << "Executing 'slaveResourcesDecorator' hook"; Resources resources; // Remove the existing "cpus" resource, it will be overwritten by the // current hook. Keep other resources unchanged. foreach (const Resource& resource, slaveInfo.resources()) { if (resource.name() != "cpus") { resources += resource; } } // Force the value of "cpus" to 4 and add a new custom resource named "foo" // of type set. resources += Resources::parse("cpus:4;foo:{bar,baz}").get(); return resources; }