onyx

FYI: alternative Onyx :onyx: chat is at <https://gitter.im/onyx-platform/onyx> ; log can be found at <https://clojurians-log.clojureverse.org/onyx/index.html>
eoliphant 2018-05-18T15:33:35.000252Z

Hi I have a pretty 101 question lol. I’ve been through the learn-onyx, etc stuff (great material BTW), but one thing that’s not clear is the best, or just a simple way to set stuff for a ‘typical’ deployment. When deploying and uberjar one would conceivably just set everything up then kick off the job. The onyx-app template seems like more of a generic job runner. trying to hack it down to just startup and run the configured job. Is something like this ‘right’?

(defn -main [&amp; args]
  (let [onyx-id (java.util.UUID/randomUUID)
        env-config (assoc (-&gt; "config.edn" io/resource slurp read-string :env-config)
                     :onyx/tenancy-id onyx-id)
        peer-config (assoc (-&gt; "config.edn"
                               io/resource slurp read-string :peer-config) :onyx/tenancy-id onyx-id)
        env (onyx.api/start-env env-config)
        peer-group (onyx.api/start-peer-group peer-config)
        peers (onyx.api/start-peers 5 peer-group)
        job-id (:job-id
                 (onyx.api/submit-job peer-config
                                      (onyx.job/register-job "basic-job" nil)))]
    (print job-id)

    #_(onyx.api/await-job-completion peer-config)
    #_(assoc component :env env :peer-group peer-group
                     :peers peers :onyx-id onyx-id)))

Travis 2018-05-18T15:36:54.000446Z

The way it used to work was by using CLI params. So one set of params would essentially just spin up your peers. If you run it with a job name it would it would submit the job to the peers

Travis 2018-05-18T15:39:18.000009Z

this main looks like it starts your peers and then immediately runs your job

eoliphant 2018-05-18T15:41:03.000636Z

yeah I’m trying to figure out the best approach if say this guy is in a docker container, etc in my case this is a ‘forever’ job, part of a cqrs-style system. So it should just come up and start processing commands

jasonbell 2018-05-18T16:25:42.000368Z

https://github.com/MastodonC/kixi.hecuba.onyx.weather

jasonbell 2018-05-18T16:26:10.000340Z

We ended up combining the startup of the peers and the job in the main function, not perfect but it handled the job in hand perfectly.

jasonbell 2018-05-18T16:26:45.000476Z

Wrapped in a Docker container and there's also a Marathon config template too so you can deploy via DCOS

jasonbell 2018-05-18T16:26:58.000494Z

It's a couple of years old now but you'll get the idea.

jasonbell 2018-05-18T16:27:06.000742Z

@eoliphant ^^

eoliphant 2018-05-18T16:27:50.000215Z

ah sweet, that looks exactly like what I need

eoliphant 2018-05-18T16:27:57.000086Z

thanks

jasonbell 2018-05-18T16:28:32.000186Z

np

jasonbell 2018-05-18T16:29:35.000233Z

There is a heartbeat server baked in there too so marathon could check the state of the container.

eoliphant 2018-05-18T16:32:40.000246Z

cool, this is going into kube, but will just add something comparable

lucasbradstreet 2018-05-18T16:34:03.000339Z

The only gotcha if you submit when you startup the peers is you should use a stable job id to make the job submission idempotent

jasonbell 2018-05-18T16:34:16.000112Z

👍

eoliphant 2018-05-18T16:38:35.000192Z

ok that makes sense

2018-05-18T20:04:57.000046Z

i have a cli tool myself, that has options to start peers, submit jobs, kill jobs and perform gc

2018-05-18T20:05:07.000265Z

it’s also exposed as a web interface

2018-05-18T20:05:16.000473Z

works pretty well tbh

2018-05-18T20:05:36.000132Z

i handle job progress monitoring on a higher level

Travis 2018-05-18T20:05:51.000532Z

sounds pretty cool

eoliphant 2018-05-18T22:31:54.000168Z

hi, do you normally set the consumer group.id via the consumer opts with onyx-kafka or is it doing something internally ?

michaeldrogalis 2018-05-18T22:41:25.000098Z

@eoliphant Onyx is managing the Kafka consumer state on its own. You can set it if you want, but if I recall right, it’s not doing anything.

lucasbradstreet 2018-05-18T22:42:31.000087Z

It’s mostly useful if you’re monitoring consumers on the kafka side

eoliphant 2018-05-18T22:42:49.000206Z

ah ok, so say separate jobs, that are reading from the same topic, onyx is taking care of offset mgmt, etc

michaeldrogalis 2018-05-18T22:43:06.000190Z

Correct. You can set it with :kafka/group-id in the catalog if you like.

michaeldrogalis 2018-05-18T22:43:12.000242Z

It defaults to "onyx".

eoliphant 2018-05-18T22:43:26.000094Z

gotcha,