       (dissoc (s/optional-key :group))
       (dissoc (s/optional-key :status))
       (merge {:framework-id (s/maybe s/Str)
-              :retries-remaining NonNegInt
+              :retries-remaining s/Int
               :status s/Str
               :state s/Str
               :submit-time (s/maybe PosInt)

                   :name (:job/name job "cookjob")
                   :ports (:job/ports job 0)
                   :priority (:job/priority job util/default-job-priority)
                   :retries_remaining (- (:job/max-retries job) (util/job-ent->attempts-consumed db job))
                   :state state
                   :status (name (:job/state job))
                   :submit_time submit-time
                   :uris (:uris resources)
                   :user (:job/user job)
                   :uuid (:job/uuid job)}]
      (cond-> job-map
              groups (assoc :groups (map #(str (:group/uuid %)) groups))
              application (assoc :application (util/remove-datomic-namespacing application))

                        (.getTime (:job/submit-time job)))
          datasets (when (seq (:job/datasets job))
                     (dl/get-dataset-maps job))
          attempts-consumed (util/job-ent->attempts-consumed db job)
          retries-remaining (- (:job/max-retries job) attempts-consumed)
          disable-mea-culpa-retries (:job/disable-mea-culpa-retries job false)
          job-map {:command (:job/command job)
                   :constraints constraints
                   :cpus (:cpus resources)
                   :disable_mea_culpa_retries disable-mea-culpa-retries
                   :env (util/job-ent->env job)
                   ; TODO(pschorf): Remove field
                   :framework_id (guess-framework-id)
