 
 (defn dump-jobs-to-csv
   "Given a mesos db, dump a csv with a row per task"
-  [task-ents file]
+  [task-ents file & {:keys [add-headers append] :or {add-headers true append false}}]
   ;; Use snake case to make it easier for downstream tools to consume
   (let [headers [:job_id :instance_id :group_id :submit_time_ms :mesos_start_time_ms :start_time_ms
                  :end_time_ms :hostname :slave_id :status :reason :user :mem :cpus :job_name
                  :requested_run_time :expected_run_time :requested_status]
         tasks (map generate-task-trace-map task-ents)]
-    (with-open [out-file (io/writer file)]
+    (with-open [out-file (io/writer file :append append)]
       (csv/write-csv out-file
-                     (concat [(mapv name headers)]
+                     (concat (when add-headers [(mapv name headers)])
                              (map (apply juxt headers) tasks))))))
 
 (defn pull-all-task-ents

                                                 :straggler-trigger-chan (async/chan)
                                                 :lingering-task-trigger-chan (async/chan)
                                                 :cancelled-task-trigger-chan (async/chan)}})
        {:keys [time-ms-between-optimizer-calls time-ms-between-rebalancing]} config]
    ;; We are setting time to enable us to have deterministic runs
    ;; of the simulator while hooking into the scheduler as non-invasively
    ;; as possible. A longer explanation can be found in the simulator dev docs.
    (DateTimeUtils/setCurrentMillisFixed simulation-time)
    (log/info "Starting simulation.")
    (with-cook-scheduler
      mesos-datomic-conn
      make-mesos-driver-fn

        config {:shares [{:cpus (/ host-cpus 10) :gpus 1.0 :mem (/ host-mem 10) :user "default"}]
                :scheduler-config {:rebalancer-config {:max-preemption 1.0}
                                   :fenzo-config {:fenzo-max-jobs-considered 200}}}
        out-trace-a (simulate hosts jobs cycle-step-ms config nil)
        out-trace-b (simulate hosts jobs cycle-step-ms config nil)]
    (is (> (count out-trace-a) 0))
    (is (> (count out-trace-b) 0))
    (is (traces-equivalent? out-trace-a out-trace-b)
