               (log/error e "Failed to kill the offensive job!")))
           (recur))))
     offensive-jobs-ch))
+
+(timers/deftimer [cook-mesos scheduler rank-jobs-duration])
+(meters/defmeter [cook-mesos scheduler rank-jobs-failures])
 
 (defn rank-jobs
   "Return a list of job entities ordered by dru.

                                     :task-lost
                                     :task-error} :instance.status/failed)
                 prior-job-state (:job/state (d/entity db job))
                 progress (try 
                              (when (:data status)
                                  (:percent (read-string (String. (:data status)))))
                          (catch Exception e

  ;; TODO these limits should come from the largest observed host from Fenzo
  ;; .getResourceStatus on TaskScheduler will give a map of hosts to resources; we can compute the max over those
  [{max-memory-gb :memory-gb max-cpus :cpus} offensive-jobs-ch jobs]
  (timers/time!
    filter-offensive-jobs-duration
    (let [max-memory-mb (* 1024.0 max-memory-gb)
          is-offensive? (partial is-offensive? max-memory-mb max-cpus)
          inoffensive (remove is-offensive? jobs)
          offensive (filter is-offensive? jobs)]
      ;; Put offensive jobs asynchronically such that it could return the
      ;; inoffensive jobs immediately.
      (async/go
        (when (seq offensive)
          (log/info "Found" (count offensive) "offensive jobs")
          (async/>! offensive-jobs-ch offensive)))
      inoffensive)))

(defn make-offensive-job-stifler
  "It returns an async channel which will be used to receive offensive jobs expected
