      :task-id task-id}))
 
 (defn launch-tasks-for-cluster
-  [compute-cluster matches pool-name conn fenzo]
+  "Launch tasks in a compute cluster and commit to Datomic. Complete match objects 
+   for Fenzo pools or partial match objects (metadata only) for Kubernetes Scheduler 
+   pools are supported."
+  [compute-cluster matches task-txns pool-name conn fenzo should-metric-offer-match-time]
   (let [compute-cluster-name (cc/compute-cluster-name compute-cluster)
-        task-txns (matches->task-txns matches)
         count-txns (count task-txns)
         matches-for-logging (format-matches-for-structured-logging matches)
         kill-lock-object (cc/kill-lock-object compute-cluster)]

            (ratelimit/spend! quota/per-user-per-pool-launch-rate-limiter token-key 1)
            (ratelimit/spend! compute-cluster-launch-rate-limiter ratelimit/compute-cluster-launch-rate-limiter-key 1))
          (prom/inc prom/scheduler-jobs-launched {:pool pool-name :compute-cluster (cc/compute-cluster-name compute-cluster)})
          (locking fenzo
            (-> fenzo
                (.getTaskAssigner)
                (.call task-request hostname)))))
      (catch Throwable t
        (log-structured/error "Error launching tasks for compute cluster"
                              {:pool pool-name :compute-cluster (cc/compute-cluster-name compute-cluster)}

                                         e)
                    (throw e)))))

            ;; Launching the matched tasks MUST happen after the above transaction in
            ;; order to allow a transaction failure (due to failed preconditions)
            ;; to block the launch.
            (prom/with-duration
              prom/scheduler-launch-all-matched-tasks-submit-duration {:pool pool-name}
              (timers/time!
                (timers/timer (metric-title "handle-resource-offer!-mesos-submit-duration" pool-name))
                (let [_ (log-structured/info "Launching matched tasks for compute cluster"
                                             {:pool pool-name :compute-cluster compute-cluster-name})]
                  ;; Mesos offers must be launched within a timeout, otherwise they expire worthless.
                  ;; We track that metric in order to catch the problem. Note that this is only 
                  ;; applicable to Mesos tasks on Fenzo. When Mesos goes away, this metric ceases 
                  ;; to be important and this can be deleted.
                  (when should-metric-offer-match-time
                    (doseq [match matches]
                      (timers/stop (-> match :leases first :offer :offer-match-timer))
                      (-> match :leases first :offer :offer-match-timer-prom-stop-fn)))
                  (#(launch-matches! compute-cluster pool-name matches fenzo)))))
            (finally
              (.. kill-lock-object readLock unlock))))))))
