func newRunOnceTask(offer *mesos.Offer, taskID string) *runOnceTask { return &runOnceTask{ State: mesos.TaskState_TASK_STAGING, Attributes: constraints.OfferAttributes(offer), TaskID: taskID, } }
func (ctx *RunOnceApplicationContext) CheckConstraints(offer *mesos.Offer) string { offerAttributes := constraints.OfferAttributes(offer) for name, constraints := range ctx.Application.GetConstraints() { for _, constraint := range constraints { attribute, exists := offerAttributes[name] if exists { if !constraint.Matches(attribute, ctx.otherTasksAttributes(name)) { framework.Logger.Debug("Attribute %s doesn't match %s", name, constraint) return fmt.Sprintf("%s doesn't match %s", name, constraint) } } else { framework.Logger.Debug("Offer does not contain %s attribute", name) return fmt.Sprintf("no %s", name) } } } return "" }