 (defn alter-job-execution!
   "Apply the function `f` to the execution with id `exec-id` in the job
   descriptor's vector of executions. Replace the old value by the job
-  execution returned by `f`."
+  execution returned by `f`. `f` is executed *outside* of a transaction
+  and may have side-effects."
   [job-desc exec-id f & args]
   (let [apply-f (fn [exec]
                   {:post [(job-ex/job-execution? %)]}

        (alter $ assoc exec-id new-exec))))
  job-desc)

(defn- update-context!
  [job-desc exec-id f & args]
  (alter-job-execution! job-desc
                         exec-id
                         (fn [exec]
                           (update-in exec [:context] #(apply f % args)))))

(defn get-job-execution
  "Obtain the job execution with id `exec-id` from the job descriptor

  if no job has been executed yet."
  [job-desc]
  (get-job-execution job-desc @(:executor job-desc)))

(defn- apply-to-last-execution
  "Apply the function `f` to the last job execution of `job-desc`. Return
