onyx-platform / learn-onyx

Learn Onyx with an interactive workshop.
Eclipse Public License 1.0
77 stars 41 forks source link

learn-onyx SG issues #20

Open lbradstreet opened 8 years ago

lbradstreet commented 8 years ago

My notes from the Singapore Onyx Dojo.

TO IMPROVE: challenge-2-2: mention batch-size / batch-timeout required i.e. partial task-map entry challenge-2-0: information model link is outdated now challenge-1-3 DAG is a bit too crazy or hard to understand

Once added, but with invalid min-max-peers, this was printed:

GENERAL

twashing commented 7 years ago

I'm going through learn onyx now, and find it to be a great resource. One suggestion though, is to provide answers to the "questions" put forth in the missing code. At the moment, I can get 2-3 (grouping) to work, with only 1 peer. But if I try to up the peer count to 3, I get an error. I've since figured this out.

The catalog config.

{:onyx/name :read-segments
       :onyx/plugin :onyx.plugin.core-async/input
       :onyx/type :input
       :onyx/medium :core.async
       :onyx/batch-size batch-size
       :onyx/batch-timeout batch-timeout
       :onyx/max-peers 3  ;; -> fails with 3, but works with 1
       :onyx/doc "Reads segments from a core.async channel"}

      {:onyx/name :identity
       :onyx/fn :workshop.challenge-2-3/segment-identity
       :onyx/type :function
       :onyx/group-by-key :user-id
       :onyx/batch-size batch-size
       :onyx/batch-timeout batch-timeout
       :onyx/flux-policy :continue
       ;; :onyx/max-peers 3  ;; -> tried with and without this entry
      }

      {:onyx/name :write-segments
       :onyx/plugin :onyx.plugin.core-async/output
       :onyx/type :output
       :onyx/medium :core.async
       :onyx/batch-size batch-size
       :onyx/batch-timeout batch-timeout
       :onyx/max-peers 3  ;; -> fails with 3, but works with 1
       :onyx/doc "Writes segments to a core.async channel"}

The exception that I get when upping the peer count.

1. Unhandled clojure.lang.ExceptionInfo
   Input task not checkpointable, as task n-peers is not fixed.
   {:job-id #uuid "9d23c075-fb6c-e575-551c-4f65010c721d", :task :read-segments, :original-exception :clojure.lang.ExceptionInfo}

                  core.clj: 4617  clojure.core/ex-info
                  core.clj: 4617  clojure.core/ex-info
        task_lifecycle.clj:  183  onyx.peer.task-lifecycle/checkpoint-input
        task_lifecycle.clj:  173  onyx.peer.task-lifecycle/checkpoint-input
        task_lifecycle.clj:  826  onyx.peer.task-lifecycle.TaskStateMachine/exec
        task_lifecycle.clj:  429  onyx.peer.task-lifecycle/iteration
        task_lifecycle.clj:  422  onyx.peer.task-lifecycle/iteration
        task_lifecycle.clj:  448  onyx.peer.task-lifecycle/run-task-lifecycle!
        task_lifecycle.clj:  437  onyx.peer.task-lifecycle/run-task-lifecycle!
        task_lifecycle.clj:  902  onyx.peer.task-lifecycle/start-task-lifecycle!/fn
                 async.clj:  439  clojure.core.async/thread-call/fn
                  AFn.java:   22  clojure.lang.AFn/run
   ThreadPoolExecutor.java: 1142  java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  617  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java:  745  java.lang.Thread/run

As a newbie, it took me a long time to figure out that I needed both min-peers and max-peers.

{...
  :onyx/min-peers 3 
  :onyx/max-peers 3 
...}
lbradstreet commented 7 years ago

@twashing thanks for the report. That error message should be better. I'll fix it in the next onyx release.

I'm thinking "Input task is not checkpointable, as the task onyx/n-peers is not set and :onyx/min-peers is not equal to :onyx/max-peers." would improve it a lot. Do you think you would have figured out what that meant?

lbradstreet commented 7 years ago

@twashing I've improved the error message and updated examples to use beta12 which includes the new message.

twashing commented 7 years ago

Hey @lbradstreet I think the main thing is communicating to the user, that those peer values have to be in a range. Your suggested error message would've helped a lot even though I don't know how the onyx/n-peers task is related to checkpointing. I was also thinking that spec could help with error messages.

Anyways, whatever works best for your code base. Thanks for the fast response. That was great!

WaygoneWilco commented 6 years ago

@lbradstreet Challenge 2-2 still has insufficient information for the learner, as you mentioned in your first comment. Only by coming to this thread did I understand that all catalog entries need to include batch-size and batch-timeout