Fork me on GitHub
#juxt
<
2020-02-26
>
onetom05:02:36

I was wondering if it would make sense to call the :components key simply :parts to avoid confusing it with the stuartsierra/components. the benefit of having something shorter is also the ability to provide functions like:

(ns some.app.feature)

(defn parts [some typical params]
  {:some-part {:start `(...)}
   :other-part {:start ...}})

dominicm07:02:32

This seems like a good idea.

onetom05:02:27

then at some entry point namespace - eg tests -, u can assemble a system, like:

(def clip 
  {:executor ... 
   :parts (merge (some.app.feature/parts 1 2 3)
                 (other.app.feature/parts :a :b :c))})

onetom05:02:58

if im reading the description of a system from an edn file, am i supposed to specify the executor there too? i have the impression that this top-level {:executor ... :components ...} structure is unnecessary noise (at this stage at least). i could imagine that we call the "part configuration" of the various subsystems *clip*s. then we can combine multiple clips into a bigger clip. if we start a clip, we get back a system. so interaction with a bigger system would look like:

@(def clip (merge (company.feature-1/clip 1 2 3)
                    (company.sub-system-2/dummy-clip :x :y)
                    (company.db/in-mem-clip)))
  @(def sys (clip/start clip optional-executor))
  (clip/stop clip sys))
where those company.*/*clip functions would just return maps like that parts function above. i feel like the system-config is a bit ambiguous term, because by config i would expect something containing more static data

dominicm07:02:58

I really want users to specify their required executor. You can merge components or parts together separately ofc.

onetom05:02:28

we can also carry the executor info with the system config map as meta data:

@(def sys (-> clip (with-meta {:executor non-default-executor}) clip/start))

dominicm07:02:09

I want something more visible than metadata for this. I think when you look at a system (print it, throw it, whatever) it should be very clear that something is changing the execution flow.

onetom07:02:39

what do u mean by system here, the config or the return value of (clip/start)? isn't the execution flow determined by the dependencies between parts in the 1st place? just by looking at a system, that's not super clear anyway, regardless of the executor. i was just wondering a few minutes ago how can i check who depends on what, because my system is getting hairing already.

dominicm07:02:57

You're right, I mean system config :) I'll blame morning brain (but really I'm just loose with the terminology). In one sense, you're right. But the sequencing between those dependencies is potentially done in a variety of ways. One major clip goal is to make the system really explicit.

dominicm07:02:08

The temporary answer now is that you could write an executor that prints out the order which things are running. Alternatively, there's some functions in the impl namespace for creating the dependency graph.

dominicm07:02:43

This seems like something worth exposing as a public API though.

onetom07:02:01

this lib is pretty nice for component: https://github.com/walmartlabs/system-viz has anyone looked into adopting it for juxt/clip?

onetom07:02:37

this is a pretty clear view of the system dependencies:

(-> clip :components (#'clip/safely-derive-parts []) first)
=> {:config #{}, :aws/credentials-provider #{:config}, :aws/ssm #{:aws/credentials-provider}}
maybe that safely-derive-parts shouldn't be a private function 🙂

dominicm07:02:50

I think, but am not certain, that you could feed clip's dependency graph straight to rhizome.

dominicm07:02:02

Maybe even to loom.

dominicm07:02:48

Yeah, open to a dependency graph function which returns a data structure like that

andrea.crotti17:02:46

I have a strange behaviour with bidi which I can't quite explain

andrea.crotti17:02:08

one route works fine locally but not in prod (so after the uberjar/docker magic)

andrea.crotti17:02:41

however if in the repl I do (bd/match-route routes "/loans") it actually returns not-found, so it would seem it doesn't work locally either

andrea.crotti17:02:28

anyway the question is simply if anyone is aware of potential issues that can occur after uberjar but not during local dev, before I dig further to understand what's going on

dominicm17:02:52

Bidi itself is pretty agnostic to all that.

andrea.crotti17:02:12

mm yeah makes sense, so I think locally it works thanks to some other magic, the thing which makes it a bit more complicated is that routes are in a cljc file. SPA routes are merged with server only routes in the api.clj ns, but then the routing is done also in the SPA directliy

andrea.crotti17:02:41

so well probably some other magic going on there, I'll have a look. if in the repl match-route doesn't work it means the route definition is just wrong I guess