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.
@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
@souenzzo (sort of) this is done in the name space with catalog definition. (I prefer this however:)
{:onyx/fn (keyword `path.ns/my-fn)}
but next, you need to make sure this my-fn
is properly required in the namespace, which starts onyx peers.
otherwise job will blow up in runtime with "you forgot to import stuff"
@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
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.
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:).
@misha That's a good approach. Sounds like you're close. 🙂