code: func (f *ClusterFixer) FindAppReleaseJobs(app, typ string) []map[string]*host.Job {
  	var sortReleases ReleasesByCreate
  	releases := make(map[string]map[string]*host.ActiveJob) // map of releaseID -> hostID -> job ordered
  	// connect to each host, list jobs, find distinct releases
  	for _, h := range f.hosts {
  		jobs, err := h.ListJobs()
  		if err != nil {
  			f.l.Error("error listing jobs", "host", h.ID(), "error", err)
  			continue
  		}
  		for _, j := range jobs {
  			if j.Job.Metadata["flynn-controller.app_name"] != app || j.Job.Metadata["flynn-controller.type"] != typ {
  				continue
  			}
  			id := j.Job.Metadata["flynn-controller.release"]
  			if id == "" {
  				continue
  			}
  			m, ok := releases[id]
  			if !ok {
  				sortReleases = append(sortReleases, SortableRelease{id, j.StartedAt})
  				m = make(map[string]*host.ActiveJob)
  				releases[id] = m
  			}
  			if curr, ok := m[h.ID()]; ok && curr.StartedAt.Before(j.StartedAt) {
  				continue
  			}
  			jobCopy := j
  			m[h.ID()] = &jobCopy
  		}
  	}
  	sort.Sort(sortReleases)
  	res := make([]map[string]*host.Job, len(sortReleases))
  	for i, r := range sortReleases {
  		res[i] = make(map[string]*host.Job, len(releases[r.id]))
  		for k, v := range releases[r.id] {
  			res[i][k] = v.Job
  		}
  	}
  	return res
  }
docs: // FindAppReleaseJobs returns a slice with one map of host id to job for each
  // known release of the given app and type, most recent first