code: func HasEnough(nodeRes []*api.GenericResource, taskRes *api.GenericResource) (bool, error) {
  	t := taskRes.GetDiscreteResourceSpec()
  	if t == nil {
  		return false, fmt.Errorf("task should only hold Discrete type")
  	}
  
  	if nodeRes == nil {
  		return false, nil
  	}
  
  	nrs := GetResource(t.Kind, nodeRes)
  	if len(nrs) == 0 {
  		return false, nil
  	}
  
  	switch nr := nrs[0].Resource.(type) {
  	case *api.GenericResource_DiscreteResourceSpec:
  		if t.Value > nr.DiscreteResourceSpec.Value {
  			return false, nil
  		}
  	case *api.GenericResource_NamedResourceSpec:
  		if t.Value > int64(len(nrs)) {
  			return false, nil
  		}
  	}
  
  	return true, nil
  }
docs: // HasEnough returns true if node can satisfy the task's GenericResource request