Fork me on GitHub
#biff
<
2023-02-15
>
Epidiah Ravachol15:02:29

Found a broken link on the Biff website: https://biffweb.com/docs/reference/transactions/ The link to com.biffweb/tx-fns about halfway down goes to localhost:8888. I was looking into whether Biff validates against the schema or coerces, because I thought I might set some default values on the schema. Looks like it just validates and—upon further, unrelated, reflection—I probably shouldn't be using the schema to set this default value anyway. Also, I just want to note that I find Biff's code very readable. This is the first big project I've attempted where I felt that way about the tools I'm using and felt comfortable just digging into the source code for answers.

Jacob O'Bryant16:02:18

good to know, I'll fix that. by the way, that transactions page mentions a :db/default operation that might be what you need. I haven't thought about coercion at all--might be worth looking into actually. also very glad the code is readable :)

2
Epidiah Ravachol19:02:03

Ah! Good to know. In fact, I should probably be using :db/union as well.

👍 2
m.q.warnock16:02:59

I updated my project to use biff 0.6; last time I updated, I kept using the ./task bash script; this time, with the secrets thing, it seemed better to try to use the new babashka tasks, but I need some extra jvm-opts ("-add-modules" "jdk.incubator.foreign" "-enable-native-access=ALL-UNNAMED") because I'm using libpython-clj. I tried adding them to run-args (I'm using a local copy of biff anyway, because I had to use tools.deps instead of tools.deps.alpha (and disable use-libs) to get flow-storm working), but although the println I added to tasks.clj to see the run-args does execute, my additional args aren't there. I'm quite confused by that, but all that really matters to me is that I can add some jvm-opts; what's the recommended way to do that?

Jacob O'Bryant17:02:19

in new/up-to-date projects there's an option in config.edn where you can specify jvm arguments. I'll type up some more info when I'm at my desk. I'm curious about the dependency conflict; does flow-storm use tools.deps + tools.deps conflicts with tools.deps.alpha? if this might be a common problem I could probably do something to make it so you don't have to run a local copy of biff.

m.q.warnock17:02:38

ah, of course; I looked right passed it. now I need to figure out how to pass them through clj; :jvm-opts in deps.edn manages that magic; just adding -J didn't work. I can figure that out, though if you happen to know... I'll refresh my memory about the flow-storm thing

m.q.warnock17:02:43

with the template project 0.6 generated (which I used to update mine), with just the flow-storm dependency added, I get this:

Error building classpath. Unable to compare versions for org.clojure/tools.deps.alpha: {:mvn/version "0.14.1222", :deps/manifest :mvn} and {:git/url "", :git/sha "8f8fc2571e721301b6d52e191129248355cb8c5a", :deps/manifest :deps, :deps/root "/home/momerath/.gitlibs/libs/org.clojure/tools.deps.alpha/8f8fc2571e721301b6d52e191129248355cb8c5a"}

m.q.warnock17:02:37

I tried lots of stuff I only vaguely remember, months ago, to get around that without modifying biff, but obviously didn't manage to

Jacob O'Bryant17:02:24

ah, I see. I'll take a crack at it.

Jacob O'Bryant18:02:07

You can put this in deps.edn:

com.github.jpmonettas/flow-storm-dbg {:mvn/version "3.3.315"
                                      :exclusions [org.clojure/tools.deps.alpha]}
i.e. tell clojure to use the version that biff specifies instead of the version flow-storm specifies. Biff uses the https://github.com/clojure/tools.deps.alpha/tree/add-lib3 branch which contains the code for adding dependencies at runtime. Hopefully that works fine for flow-storm--I've verified that the project starts at least, but let me know if you run into any problems during development.

Jacob O'Bryant19:02:31

> now I need to figure out how to pass them through clj; :jvm-opts in deps.edn manages that magic; just adding -J didn't work. I can figure that out, though if you happen to know... hm, from the docs it looks like -J and :jvm-opts should be equivalent. Does this work?

:biff.tasks/clj-args ["-J--add-modules"
                      "-Jjdk.incubator.foreign"
                      "-J--enable-native-access=ALL-UNNAMED"
                      ...

m.q.warnock19:02:50

Thanks! Ran an errand; back at it now. I tried your example, and quoting the --add-modules jdk-incubator-foreign , or just leaving off the -J for that argument; they all balk at jdk-incubator-foreign in one way or another

run-args:  [-J-XX:-OmitStackTraceInFastThrow -J-XX:+CrashOnOutOfMemoryError -J-Duser.timezone=UTC -J--add-modules jdk.incubator.foreign -J--enable-native-access=ALL-UNNAMED -J-Xmx80g -M -m software.sacred --port 7888 --middleware [cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]]
Unrecognized option: --add-modules jdk.incubator.foreign
You've helped enough, though; I'll read the docs and figure it out

Jacob O'Bryant19:02:40

hm, well good luck!

Jacob O'Bryant20:02:47

if all else fails, you can make an alias in deps.edn that includes :jvm-opts, and update :biff.tasks/clj-args so that it includes the alias

m.q.warnock20:02:02

the next thing I tried worked 🙂 - used an = instead of the space

👌 2
🎅 2