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>
misha 2018-01-28T09:32:21.000045Z

greetings! what is the cleanest and easiest rule to follow to keep onyx-peers (the one with the -main) name space's :require's short and working? Assuming there are bunch of namespaces with catalogs and workflows elsewhere, and I don't want to get a "ClassNotFound, did you forget to require things?" at runtime.

souenzzo 2018-01-28T11:03:18.000052Z

@misha not sure if I understand, but I always require the ns then use the short/reference form of keyword [full.path.ns :as path.ns] and :onyx/fn ::path.ns/my-fn

misha 2018-01-28T12:07:10.000029Z

@souenzzo (sort of) this is done in the name space with catalog definition. (I prefer this however:)

{:onyx/fn (keyword `path.ns/my-fn)}

misha 2018-01-28T12:09:14.000036Z

but next, you need to make sure this my-fn is properly required in the namespace, which starts onyx peers.

misha 2018-01-28T12:09:46.000023Z

otherwise job will blow up in runtime with "you forgot to import stuff"

michaeldrogalis 2018-01-28T20:24:44.000127Z

@misha You only need to reference functions that ought to be on the classpath - you don't need job-level data (workflows/catalogs/etc) on the classpath at runtime for the peer

michaeldrogalis 2018-01-28T20:26:10.000057Z

You could do something simple like a single, or small set, of namespaces with your functionality in them to require. Or you can do something more advanced like static analysis of your jobs and the dependencies of your peer ns.

misha 2018-01-28T22:31:07.000065Z

I'd like to: 1. have every catalog use (keyword `sym), as it forces you to require job-related fns in the catalog ns. 2. only require catalog ns in peers ns, with the assumption that (1) took care of the rest. (1) - is solved. (2) might require few lines of magic written once at the top of peers ns, and I'm ok with that (but did not come up with one yet :opieop:).

michaeldrogalis 2018-01-28T22:34:21.000034Z

@misha That's a good approach. Sounds like you're close. 🙂