 (defmethod extensions/bucket-at [ZooKeeper :task]
   [sync _ subpath]
   (let [prefix (:onyx/id (:opts sync))
-        job-id (trailing-id subpath) 
+        job-id (leaf subpath) 
         children (or (zk/children (:conn sync) (task-path prefix job-id)) [])]
     (map #(str (task-path prefix job-id) "/" %) children)))
 

  (str root-path "/" prefix))

(defn peer-path [prefix]
  (str root-path "/" prefix "/peer"))

(defn peer-state-path [prefix]
  (str root-path "/" prefix "/peer-state"))

(defn pulse-path [prefix]
  (str root-path "/" prefix "/pulse"))

(defn payload-path [prefix]
  (str root-path "/" prefix "/payload"))

(defn ack-path [prefix]
  (str root-path "/" prefix "/ack"))

(defn exhaust-path [prefix]
  (str root-path "/" prefix "/exhaust"))

(defn seal-path [prefix]
  (str root-path "/" prefix "/seal"))

(defn completion-path [prefix]
  (str root-path "/" prefix "/completion"))

(defn cooldown-path [prefix]
  (str root-path "/" prefix "/cooldown"))

(defn status-path [prefix]
  (str root-path "/" prefix "/status"))

(defn catalog-path [prefix]
  (str root-path "/" prefix "/catalog"))

(defn workflow-path [prefix]
  (str root-path "/" prefix "/workflow"))

(defn shutdown-path [prefix]
  (str root-path "/" prefix "/shutdown"))

(defn job-path [prefix]
  (str root-path "/" prefix "/job"))

(defn task-path [prefix subpath]
  (str root-path "/" prefix "/task/" subpath))

(defn plan-path [prefix]
  (str root-path "/" prefix "/plan"))

(defn election-path [prefix]
  (str root-path "/" prefix "/election"))

(defn job-log-path [prefix]
  (str root-path "/" prefix "/job-log"))

(defn born-log-path [prefix]
  (str root-path "/" prefix "/coordinator/born-log"))

(defn death-log-path [prefix]
  (str root-path "/" prefix "/coordinator/death-log"))

(defn planning-log-path [prefix]
  (str root-path "/" prefix "/coordinator/planning-log"))

(defn ack-log-path [prefix]
  (str root-path "/" prefix "/coordinator/ack-log"))

(defn evict-log-path [prefix]
  (str root-path "/" prefix "/coordinator/evict-log"))

(defn offer-log-path [prefix]
  (str root-path "/" prefix "/coordinator/offer-log"))

(defn revoke-log-path [prefix]
  (str root-path "/" prefix "/coordinator/revoke-log"))

(defn exhaust-log-path [prefix]
  (str root-path "/" prefix "/coordinator/exhaust-log"))

(defn seal-log-path [prefix]
  (str root-path "/" prefix "/coordinator/seal-log"))

(defn complete-log-path [prefix]
  (str root-path "/" prefix "/coordinator/complete-log"))

(defn shutdown-log-path [prefix]
  (str root-path "/" prefix "/coordinator/shutdown-log"))

(defrecord ZooKeeper [opts]
  component/Lifecycle

(defn zookeeper [opts]
  (map->ZooKeeper {:opts opts}))

(defn leaf [s]
  (last (clojure.string/split s #"/")))

(defn serialize-edn [x]
