sixthnormal / clj-3df

Clojure(Script) client for Declarative Dataflow.
Eclipse Public License 2.0
327 stars 13 forks source link

How to run clj-3df? #34

Open theronic opened 5 years ago

theronic commented 5 years ago

Hi guys! This looks promising, but I can't figure out how to use it. I cloned the repo, am running a differential dataflow server. Updated Leiningen to fetch some newer deps. When I try to run any of the clj-3df examples, I get an error like this:

~/Projects/clj-3df  master ?  clj -m lww                                                                                                            1 ↵  3240  19:47:21
[MIDDLEWARE] running
Exception in thread "main" java.lang.ClassCastException: clojure.core.async.impl.channels.ManyToManyChannel cannot be cast to manifold.bus.IEventBus
    at lww$_main.invokeStatic(lww.clj:52)
    at lww$_main.invoke(lww.clj:50)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.lang.Var.applyTo(Var.java:702)
    at clojure.core$apply.invokeStatic(core.clj:657)
    at clojure.main$main_opt.invokeStatic(main.clj:317)
    at clojure.main$main_opt.invoke(main.clj:313)
    at clojure.main$main.invokeStatic(main.clj:424)
    at clojure.main$main.doInvoke(main.clj:387)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:702)
    at clojure.main.main(main.java:37)

Or like this:

 ~/Projects/clj-3df  master ?  clj -m runner lww                                                                                               INT(-2) ↵  3241  19:49:53
Exception in thread "main" java.lang.RuntimeException: No such var: df/debug-conn, compiling:(runner.clj:10:18)
    at clojure.lang.Compiler.analyze(Compiler.java:6792)
    at clojure.lang.Compiler.analyze(Compiler.java:6729)
    at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3813)
bachdavi commented 5 years ago

The examples are not up-to-date with changes from a few months ago. We are now exclusively using core.async channels for communication between the server and Clojure. I'll create an issue and fix the examples soon.

theronic commented 5 years ago

Thanks! Could you provide minimal instructions to get started with a pub/sub so I can play around a bit over the weekend? :)

bachdavi commented 5 years ago

Yeah sure! We should update the readme too and provide some more instructions :)

When you have a look here in the core.cljc file you see an example: https://github.com/comnik/clj-3df/blob/9d0352b49c2618d23641d8692779c4e6e924f9e9/src/clj_3df/core.cljc#L291-L320

bachdavi commented 5 years ago

If you use create-publication the conn map will contain a :pub key that has an async-pub which dispatches on the name of the registered query. In this case it would be "loans". create-debug-publication will pipe every output that the server send also to the repl.

Hope that helps

bachdavi commented 5 years ago

The examples should work now. For the example rga you need to use a different branch from the server. ldbc requires you to have the data...

comnik commented 5 years ago

Hey yeah sorry for that, the examples are somewhat internal still. We will try and get some more usable ones out there. Lots of things are happening on the back-end right now, hard to keep up :)

(Keeping this open for now, until we have some more examples / @theronic confirms he's somewhat good to go)

halljson commented 5 years ago

... am running a differential dataflow server. ...

Just wanted to clarify that the running server needs to be the declarative dataflow server: https://github.com/comnik/declarative-dataflow/tree/v0.1.0#build--run

Also, the code snippet posted here is slightly out of date; looks like create-conn was renamed to create-conn! (among a few other small changes). https://github.com/comnik/clj-3df/blob/master/src/clj_3df/core.cljc#L292 appears to be up to date.