                                                      :fn function/read-input-batch})
       (#{:function :output} task-type)        (conj {:lifecycle :lifecycle/read-batch
                                                      :fn function/read-function-batch})
-      ; (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/dead-peer-detection
-      ;                                                :fn dead-peer-detection})
       (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/after-read-batch
                                                      :fn (build-lifecycle-invoke-fn event :lifecycle/after-read-batch)})
       (#{:input :function :output} task-type) (conj {:lifecycle :lifecycle/apply-fn

(defn new-task-information [peer task]
  (map->TaskInformation (select-keys (merge peer task) [:log :job-id :task-id :id])))

;; Publisher heartbeats
;; At the start of each cycle, set all publications to used? false
;; Whenever you send a message / barrier / whatever to a publication, set used? true
;; At the end of the cycle, send heartbeats to used? false publications
;; Make all of this done by the messenger

;; Subscriber heartbeats
;; At the end of each cycle, check whether subscriber is still alive
;; If it is not, do not send a message and consider re-establishing via log message / peer reboot
;; If it is, then send a heartbeat in the backchannel to the publisher

;; TODO, try to filter out lifecycles that are actually identity
(defn filter-task-lifecycles 
  [{:keys [onyx.core/task-map onyx.core/windows onyx.core/triggers] :as event}]
  (let [task-type (:onyx/type task-map)

        subscriber (m/subscriber (get-messenger state))] 
    (set-output-pipeline! state pipeline)
    (if advance?
      (cond-> (next-epoch! state)

        (and (sub/completed? subscriber) 
