code: func (a *Agent) units() (unitStates, error) {
  	launched := pkg.NewUnsafeSet()
  	for _, jName := range a.cache.launchedJobs() {
  		launched.Add(jName)
  	}
  
  	loaded := pkg.NewUnsafeSet()
  	for _, jName := range a.cache.loadedJobs() {
  		loaded.Add(jName)
  	}
  
  	units, err := a.um.Units()
  	if err != nil {
  		return nil, fmt.Errorf("failed fetching loaded units from UnitManager: %v", err)
  	}
  
  	filter := pkg.NewUnsafeSet()
  	for _, u := range units {
  		filter.Add(u)
  	}
  
  	uStates, err := a.um.GetUnitStates(filter)
  	if err != nil {
  		return nil, fmt.Errorf("failed fetching unit states from UnitManager: %v", err)
  	}
  
  	states := make(unitStates)
  	for uName, uState := range uStates {
  		js := job.JobStateInactive
  		if loaded.Contains(uName) {
  			js = job.JobStateLoaded
  		} else if launched.Contains(uName) {
  			js = job.JobStateLaunched
  		}
  		us := unitState{
  			state: js,
  			hash:  uState.UnitHash,
  		}
  		states[uName] = us
  	}
  
  	return states, nil
  }
docs: // units returns a map representing the current state of units known by the agent.