Fork me on GitHub
#onyx
<
2017-04-22
>
lmergen15:04:44

ok, i’m thoroughly confused. what would be the best way to get an overview of the active jobs in the cluster, comparable to what onyx dashboard does ? or is the best approach to keep a record of jobs currently in the cluster, separately from onyx ?

lmergen15:04:19

i was thinking about aggregating the current log

lmergen15:04:58

but for that i need to actually join the cluster, which seems to be a non-trivial thing to do

lmergen15:04:57

right, that was plan B 🙂

lmergen15:04:17

that’s actually the recommended approach ?

gardnervickers15:04:53

Kinda depends on what you’re trying to do. Are you building your own dashboard?

lmergen15:04:26

nah, just a small layer of cli tools on top of onyx for my own internal use

lmergen15:04:54

so that i can integrate them in, say, monitoring tools

lmergen15:04:13

or that i can query the cluster for currently running jobs, in case i need to do an upgrade

gardnervickers15:04:27

Yea I think that would be easiest to integrate with

gardnervickers15:04:09

Joining and following the log isn’t very difficult, but overkill for something like that.

lmergen15:04:21

okay, thanks

gardnervickers15:04:01

It just connects to ZK and shoves events through the Onyx state machine

lmergen15:04:03

that doesn’t look too difficult indeed

gardnervickers15:04:08

It’s pretty much what the http replica server does without the nice rest endpoint.

lmergen15:04:53

but that doesn’t actually join the cluster, right ?

lmergen16:04:11

that’s my problem — subscribing to the log is easy, joining the cluster is a different thing

gardnervickers16:04:38

Why do you need to join the cluster?

lmergen16:04:03

it seems i’m not getting any other logs than ‘prepare join cluster’ if i don’t actually join it

gardnervickers16:04:40

What are you using now?

lmergen16:04:02

this is what i was doing

(defn list-jobs [config]
  (let [logs (chan)]
    (println "subscribing to onyx")

    (go-loop []
      (let [x (<! logs)]
        (println "got log: " (pr-str x))))

    (onyx.api/subscribe-to-log config logs)

    (Thread/sleep 15000)))

gardnervickers16:04:02

Yea that’ll just loop once, you need to recur

lmergen16:04:25

right, i’ve had a long day

lmergen16:04:38

thanks for your help @gardnervickers

lmergen16:04:35

yep, worked like a charm

michaeldrogalis17:04:53

@lmergen Ha, that one gave me a laugh.

lmergen17:04:33

classic case of thinking the problem is way more difficult than it actually was :)

michaeldrogalis17:04:45

Glad you got through it 🙂

lmergen17:04:14

yep. now that you're here, i recall you mentioned that you're actually keeping track of jobs in a separate database at distributed masonry, is this correct ?

lmergen17:04:27

is that just to make querying job status a bit faster ?

lmergen17:04:07

at this point, im actually considering feeding onyx its own log and ceate aggregates out of it... for science, of course :)

michaeldrogalis17:04:33

@lmergen Yeah, we have a separate database to track job status. The trick is that it’s only allowed to be updated by a log subscriber. That let’s us avoid having incorrect or stale information. We’re using a separate database because we need to integrate that with other information for Pyroclast. Additionally, we’re seamlessly migrating and tracking job status across Onyx tenancies.

lmergen17:04:13

right, that makes sense

michaeldrogalis17:04:13

You get a deterministic replica everytime you play the log from the beginning, so everytime you boot up your system, you can update your external database with any new information while it was down.

michaeldrogalis17:04:49

If you’re just making some CLI tools, the log subscriber by itself might be fine. If you have the replica, the active jobs are just (keys (:allocations replica)) 🙂

lmergen17:04:25

yes, derive state from onyx, rather than keeping a shadow database

lmergen17:04:50

i might take that approach later on. it makes sense i think, especially when doing a lot of migrations

lmergen17:04:13

i think its great how simple onyx has remained. its tempting to build out an ecosystem of tools around it (and there are some, like the dashboard), but the core has remained very simple

lmergen17:04:44

and it's very interesting to see the different approaches you can take with a few of these core facilities, such as log subscription

lmergen17:04:58

i think rich would be proud :)

michaeldrogalis18:04:31

@lmergen Thanks 🙂 I wish our public tooling for this stuff was a bit more unified, but I can’t complain about the fact that most of it is still easy to build without needing changes to core.

lmergen18:04:06

i think it shows the various directions you can go, without forcing you into a single one

michaeldrogalis18:04:46

It’s simple - so long as you remember to recur that loop 😄

lmergen18:04:02

yeah well, that was simply stupid ;)

gardnervickers18:04:14

One bad habit I can’t drop is using (get :keyword map) instead of (get map :keyword). I have no idea where I picked it up but I do it all the time now.

michaeldrogalis18:04:43

Chalk me up for that one, too.

mpenet20:04:00

Same, probably caused by switching back and forth with erlang lately