code: func setTargetStateOfUnits(units []string, state job.JobState) ([]*schema.Unit, error) {
  	triggered := make([]*schema.Unit, 0)
  	for _, name := range units {
  		u, err := cAPI.Unit(name)
  		if err != nil {
  			return nil, fmt.Errorf("error retrieving unit %s from registry: %v", name, err)
  		} else if u == nil {
  			return nil, fmt.Errorf("unable to find unit %s", name)
  		} else if job.JobState(u.DesiredState) == state {
  			log.Debugf("Unit(%s) already %s, skipping.", u.Name, u.DesiredState)
  			continue
  		}
  
  		log.Debugf("Setting Unit(%s) target state to %s", u.Name, state)
  		if err := cAPI.SetUnitTargetState(u.Name, string(state)); err != nil {
  			return nil, err
  		}
  		triggered = append(triggered, u)
  	}
  
  	return triggered, nil
  }
docs: // setTargetStateOfUnits ensures that the target state for the given Units is set
  // to the given state in the Registry.
  // On success, a slice of the Units for which a state change was made is returned.
  // Any error encountered is immediately returned (i.e. this is not a transaction).