                             (:job/_instance task)))))]
     jobs))
 
-(timers/deftimer [cook-mesos scheduler rank-jobs-duration])
-(meters/defmeter [cook-mesos scheduler rank-jobs-failures])
+(timers/deftimer [cook-mesos scheduler filter-offensive-jobs-duration])
+
+(defn is-offensive?
+  [max-memory-mb max-cpus job]
+  (let [{memory-mb :mem
+         cpus :cpus} (util/job-ent->resources job)]
+    (or (> memory-mb max-memory-mb)
+        (> cpus max-cpus))))
 
 (defn filter-offensive-jobs
   "Base on the constraints on memory and cpus, given a list of job entities it

                                     :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

              (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.
