This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-22
Channels
- # adventofcode (26)
- # aleph (34)
- # announcements (10)
- # babashka (71)
- # beginners (80)
- # biff (7)
- # calva (1)
- # cider (4)
- # cljdoc (12)
- # clojure (8)
- # clojure-belgium (1)
- # clojure-europe (11)
- # clojure-nl (3)
- # clojure-norway (18)
- # clojure-sg (3)
- # clojure-sweden (2)
- # clojurescript (18)
- # clojutre (4)
- # conjure (1)
- # core-logic (4)
- # datahike (1)
- # datascript (3)
- # emacs (27)
- # exercism (1)
- # gratitude (12)
- # introduce-yourself (4)
- # joyride (1)
- # lsp (46)
- # malli (3)
- # membrane (2)
- # nbb (1)
- # off-topic (3)
- # other-languages (7)
- # pedestal (4)
- # portal (3)
- # practicalli (1)
- # rdf (33)
- # re-frame (11)
- # releases (1)
- # ring (1)
- # scittle (34)
- # shadow-cljs (10)
- # squint (12)
- # tools-deps (89)
- # tree-sitter (2)
- # xtdb (14)
here's a strange message. i just installed clj and am trying to run a regular clojure program using clj which works fine locally. but it seems clojure now depends on babashka? i'm not using babashka, it's not installed, it's not referenced and yet it's trying to find it? even if i install it, i get the same error. it's beyond comprehension why it would be looking for babashka.process.Process
or why that would have anything to do with clj. i wasn't sure if i should post this in this channel or the clojure channel.
clj -M screenshot.clj
Starting ...
java.lang.IllegalArgumentException: Multiple methods in multimethod 'simple-dispatch' match dispatch value: class babashka.process.Process -> interface clojure.lang.IDeref and interface clojure.lang.IPersistentMap, and neither is preferred
at clojure.lang.MultiFn.findAndCacheBestMethod(MultiFn.java:179)
at clojure.lang.MultiFn.getMethod(MultiFn.java:150)
at clojure.lang.MultiFn.getFn(MultiFn.java:154)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
_base.clj:194)jure.pprint$write_out.invokeStatic(pprint
at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
ke(dispatch.clj:113)print$pprint_map$fn__11151.invo
at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
6) at clojure.pprint$pprint_map.invoke(dispatch.clj:10
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint_vector$fn__11136.invoke(dispatch.clj:95)
at clojure.pprint$pprint_vector.invokeStatic(dispatch.clj:94)
at clojure.pprint$pprint_vector.invoke(dispatch.clj:92)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
pprint_map.invoke(dispatch.clj:106)
at clojure.lang.MultiFn.invoke(MultiFn.java:229)
at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
at clojure.pprint$pprint$fn__10392.invoke(pprint_base.clj:249)
at clojure.pprint$pprint.invokeStatic(pprint_base.clj:248)
at clojure.pprint$pprint.invoke(pprint_base.clj:241)
at clojure.pprint$pprint.invokeStatic(pprint_base.clj:245)
at clojure.pprint$pprint.invoke(pprint_base.clj:241)
at clojure.lang.Var.invoke(Var.java:384)
port_error$fn__9280$fn__9281.invoke(main.clj:603)
at clojure.main$report_error$fn__9280.invoke(main.clj:602)
at clojure.main$report_error.invokeStatic(main.clj:601)
at clojure.main$main.invokeStatic(main.clj:666)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40)
deps.edn:
{:paths ["."]
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
etaoin/etaoin {:mvn/version "1.0.38"}}}
The solution is in the README of etaoin: the babashka process library is used in etaoin and you can enable its pprint method following that
I think this shouldn't happen with the newest etaoin at all anynmore since babashka.process/pprint is already required there
@U053KNT7C. The original message got a bit long for the main channel. We deleted it and I'm posting it back here now:
> here's a strange message. i just installed clj and am trying to run a regular clojure program using clj which works fine locally. but it seems clojure now depends on babashka? i'm not using babashka, it's not installed, it's not referenced and yet it's trying to find it? even if i install it, i get the same error. it's beyond comprehension why it would be looking for babashka.process.Process
or why that would have anything to do with clj. i wasn't sure if i should post this in this channel or the clojure channel.
>
clj -M screenshot.clj
> Starting ...
> java.lang.IllegalArgumentException: Multiple methods in multimethod 'simple-dispatch' match dispatch value: class babashka.process.Process -> interface clojure.lang.IDeref and interface clojure.lang.IPersistentMap, and neither is preferred
> at clojure.lang.MultiFn.findAndCacheBestMethod(MultiFn.java:179)
> at clojure.lang.MultiFn.getMethod(MultiFn.java:150)
> at clojure.lang.MultiFn.getFn(MultiFn.java:154)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> _base.clj:194)jure.pprint$write_out.invokeStatic(pprint
> at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
> at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
> ke(dispatch.clj:113)print$pprint_map$fn__11151.invo
> at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
> at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
> 6) at clojure.pprint$pprint_map.invoke(dispatch.clj:10
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint_vector$fn__11136.invoke(dispatch.clj:95)
> at clojure.pprint$pprint_vector.invokeStatic(dispatch.clj:94)
> at clojure.pprint$pprint_vector.invoke(dispatch.clj:92)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
> .pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
> at clojure.pprint$pprint_map.invoke(dispatch.clj:106)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint_map$fn__11151$fn__11153.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map$fn__11151.invoke(dispatch.clj:113)
> at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:112)
> pprint_map.invoke(dispatch.clj:106)
> at clojure.lang.MultiFn.invoke(MultiFn.java:229)
> at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194)
> at clojure.pprint$pprint$fn__10392.invoke(pprint_base.clj:249)
> at clojure.pprint$pprint.invokeStatic(pprint_base.clj:248)
> at clojure.pprint$pprint.invoke(pprint_base.clj:241)
> at clojure.pprint$pprint.invokeStatic(pprint_base.clj:245)
> at clojure.pprint$pprint.invoke(pprint_base.clj:241)
> at clojure.lang.Var.invoke(Var.java:384)
> port_error$fn__9280$fn__9281.invoke(main.clj:603)
> at clojure.main$report_error$fn__9280.invoke(main.clj:602)
> at clojure.main$report_error.invokeStatic(main.clj:601)
> at clojure.main$main.invokeStatic(main.clj:666)
> at clojure.main$main.doInvoke(main.clj:616)
> at clojure.lang.RestFn.applyTo(RestFn.java:137)
> at clojure.lang.Var.applyTo(Var.java:705)
> at clojure.main.main(main.java:40)
>
> deps.edn:
> {:paths ["."]
> :deps {org.clojure/clojure {:mvn/version "1.11.1"}
> etaoin/etaoin {:mvn/version "1.0.38"}}}
> Yes, latest release of etaoin should address this, please let us know if you still have issues in #C7KDM0EKW
sorry, i didn't know about the traces. i'll use a snippet next time. thank u all for u'r responses
Dear babashka friends! Please keep your questions coming, but I don't like messages that flood this channel with long stack traces. If you provide those, please use a snippet, gist or post them in a thread. In case of flooding, I will ask an admin to remove the message and move it to a thread in case the original poster doesn't respond within an hour. Thank you!
Sharing them as a snippet is also an alternative - at least I find snippets useful for longer stacktraces.
I wonder if the admins would want to create a Clojure slack management bot? This could do things like • detect if people are sending multiple messages in a row. If it’s the first time communicating with them, show them how to thread the message. If it’s the nth time, just a gentle threading reminder. • detect if messages are extremely long / contain a stacktrace and ask them to put the subject line of the question and the detail in the thread. etc. I am sure there is a lot of admin overhead that could be added into the bot to automate the moderation a bit
@U015Y1A1N8Y I expect the Admins would welcome someone volunteering their time and effort to help with their moderation effort -- but don't appreciate people suggesting extra work for the Admin team (who are all volunteers themselves)... @U04V15CAJ Slack does not provide any way to "move [messages] to a thread" -- we can only delete messaes.
@U04V70XH6 I know, but what we did above is start the thread, delete the top message and repost it in the thread.
Yeah, the only problem with that is the Admin then ends up in a thread they may not be interested in and the message's OP is lost (and then other people have a habit of @-ing the Admin about stuff in that thread). In the end, it just causes more work for us. I'll have a look at the permissions setup and see if we can provide a group of trusted folks as "channel owners" the ability to delete other people's messages as a way for those folks to better manage their own projects' channels...
...Hmm, the only options are "Everyone" and "Workspace owners and Admins" so we'd have to expand the pool of Admins to make that possible. Do you want to become a general Admin of the Workspace, @U04V15CAJ? 🙂
> Yeah, the only problem with that is the Admin then ends up in a thread they may not be interested in You can unsubscribe from the thread afterwards :)
I’ve seen https://github.com/brunolemos/threadbot being used at places. Kinda annoying in the beginning but people catch on 😅
This sounds almost what I want, but it doesn't have the long stacktrace detection right? ;)
Yeah, that can be contributed I think!
The thing that it does already is more complicated than long Stacktrace detection I think.
Does Babashka have an equivalent to clojure -Sdescribe
?
Haha, indeed, but something that would show intel like :config-dir
etc.
Context: I reached a CI situation where launching a BB task tries to create a /.clojure/.cpcache
dir (and fails because it's not the right place).
Ah well, it seems it won't help:
$ bb clojure -Sdescribe
Picked up JAVA_TOOL_OPTIONS: -Duser.home=/var/lib/gitlab-runner
Error building classpath. Can't create directory: /.clojure/.cpcache
Hmm, -Sdescribe
doesn't really need to build a classpath, I guess... what platform are you using?
This is on a Nix-based runner, I'm trying to figure it out with @U033F53LU0M who is our Ops angel
This looks really fishy doesn't it:
$ bb --version
Picked up JAVA_TOOL_OPTIONS: -Duser.home=/var/lib/gitlab-runner
Error building classpath. Can't create directory: /.clojure/.cpcache
Oh I see, this is coming from Clojure:
$ JAVA_TOOL_OPTIONS="-Duser.home=/tmp/dude" clj
Picked up JAVA_TOOL_OPTIONS: -Duser.home=/tmp/dude
Clojure 1.11.0
But why does it kick in with bb --version
?
To set the home dir for bb you can do it like this:
bb -Duser.home=/var/lib/gitlab-runner
Okay so it seems indeed that there is some trouble related to HOME, if you compare BB Vs Clojure CLI -Sdescribe
: https://gist.github.com/helins/3d1fcb280e2c62df067cd8dac0fb8e3e
Great, seems like a fix, I think we can figure out the rest now! Thanks, very helpful as always 🙂
but this part of the post doesn't hold anymore:
> Babashka doesn’t support -Sdeps
The latest version does now
cc @U066U8JQJ
For the sake of posterity, the root cause of this discrepancy turns out to be https://bugs.openjdk.org/browse/JDK-8280357
tl;dr almost everything besides Java uses $HOME
to find the home directory, but Java uses getpwuid
. Since we run our gitlab-runners with systemd's DynamicUser
setting, this causes the aforementioned discrepancy. We had worked around this discrepancy via the JAVA_TOOL_OPTIONS
thing mentioned earlier, but that broke for some bb
invocations.
I think I may disable DynamicUser
altogether and rework the isolation story for our CI runners.
They did fix this upstream in OpenJDK eventually: https://github.com/openjdk/jdk/pull/7534 but it will take forever until that makes it into an LTS release
Is there a way of having concurrent babashka.process
processes? dialog
has an option that creates a progress bar by watching stdin for integers, so you can do something like some-long-thing | dialog --gauge
and it'll watch the stdin for integers as it runs, and use those to update the progress in the dialog. But I'm having trouble translating that behavior to babashka, because while you can capture the :out
of a process
and pass it to a second, it blocks until the first is done rather than updating as it runs.
Frex, this will work from the shell:
bb -e '(doseq [x (range 1 100)] (Thread/sleep 100) (println x))' | dialog --gauge "Testing" 0 0
@U13N2SPMZ Yes, this is possible. To do this, use process
, not shell
since shell
is blocking
I have been but I think the order of dereferencing might be wrong? Lemme post some snippets, just a sec.
You launch dialog like this:
(process "dialog --gauge 'Testing' 0 0")
which returns a thing that has :in
and :out
. I assume you want to see the results immediately, so you provide :err :inherit
, assuming that dialog writes to stderr for visualization:
(process {:err :inherit} "dialog --gauge 'Testing' 0 0")
and so
(process {:err :inherit} "dialog --gauge 'Testing' 0 0")
returns a a map that has :in
, a stream that you can write to(require '[babashka.process :refer [process]]
'[ :as io])
(let [dialog (process {:out :inherit
:err :string} "dialog --gauge 'Testing' 0 100")]
(with-open [in (io/writer (:in dialog))]
(binding [*out* in]
(doseq [i (range 1 101)]
(println i)
(Thread/sleep 10))
(println "99")))
(println (:err @dialog))
nil)
OK, that does work at least. The question is how can I generalize this such that someone can provide arbitrary processes. :thinking_face: