// Filter nodes by conditional service and tag func (et *EventTask) filterNodes(nodes []*api.Node) []*api.Node { var results []*api.Node for _, node := range nodes { r, err := getNodeTaskResult(et.ID, et.No, node.Node) if err == nil && r != nil || util.HasCatalogRecord(node.Node, et.Service, et.Tag) { results = append(results, node) } } return results }
func (et *EventTask) Runnable(node string) bool { // Target node doesn't have conditional service or tag if !util.HasCatalogRecord(node, et.Service, et.Tag) { return false } // Skip task when task had executed already nodeResult, err := getNodeTaskResult(et.ID, et.No, node) if err != nil { return false } if nodeResult != nil && nodeResult.IsFinished() { return false } return true }