Fork me on GitHub
#babashka
<
2021-09-27
>
mmer09:09:18

Thank you very much @borkdude - I will give it a try.

David Pham09:09:22

Is there a limit to the number of threads running inside babashka? If yes, is there a way to increase it?

borkdude09:09:50

@neo2551 Can you explain the background of your question

David Pham09:09:43

Sure, I am trying to call multiple command line programs concurrently using babashka

David Pham10:09:33

think of calling a function with 10 parameters, but that could be handle asynchrnously.

David Pham10:09:15

I am currnetly usuing the future function for acheiving asynchronousy

David Pham10:09:47

but babashka only launch 3 function calls at the time.

David Pham10:09:13

Is it clearer?

borkdude10:09:35

Have you tested this with normal Clojure? I doubt this is specific to bb. It's not limited to 3 threads by default.

David Pham10:09:44

Nope, I could try.

borkdude10:09:49

It might be something in your program.

borkdude10:09:57

If you're for example using locking or so

David Pham10:09:58

I use process and fuure

David Pham10:09:11

really just (future (process "some args"))

borkdude10:09:17

You don't need to use futures with babashka.process btw, processes are already their own process

David Pham10:09:36

thanks šŸ™‚

borkdude10:09:33

Perhaps something similar is possible for scoop as well @UBLU3FQRZ? ;)

borkdude13:09:54

I guess that "CLI" can declare a dependency on the other bb manifest?

littleli13:09:59

not really. In scoop the philosophy is that project should be fairly "enclosed" that's why you would have to distribute bb along with your script(s)

borkdude13:09:09

oh that's a pity

littleli13:09:13

enclosed and independent of each other, as much as possible

littleli13:09:15

it is a good thing šŸ™‚

borkdude13:09:23

so when you need java you have to install java x times?

littleli13:09:26

you just need one java

littleli13:09:42

but you cannot create "shims" based on something external.

littleli13:09:01

as far as my understanding is

borkdude13:09:33

then I don't understand. when you install the clojure CLI which needs java, you can depend on the other java package. why not the same for bb

littleli13:09:35

above example leads to: say-hello.exe which translates to: bb.exe -f hello.clj

littleli13:09:15

you can't do AFAIK shim of someting that's external

borkdude13:09:24

what do you mean "external"

littleli13:09:33

each scoop has it's own directory

littleli13:09:43

babashka has a directory (with version)

littleli13:09:51

java has a directory with version too

littleli13:09:56

they're independent

littleli13:09:31

if you want to make a shim, that's a single executable. this program needs to sit in the same directory as the package

borkdude13:09:31

I understand. But when you install the clojure CLI, surely it won't install its own internal java?

borkdude13:09:49

why can't the shim call the globally installed bb then?

littleli13:09:01

you won't be able to build shim

borkdude13:09:22

I think you can build a better shim, you don't need to make an executable

littleli13:09:26

because shim is based on things that are local to your scoop package

borkdude13:09:34

you can just have a .bat file with a "shebang"

littleli13:09:42

that's probably true

borkdude13:09:01

it's a bit hacky, but it works well

borkdude13:09:29

or just a .bat file which calls bb -f foo.clj itself

littleli13:09:49

that's probably the most straightforward way

borkdude13:09:43

Perhaps we can write a documentation page how to package your bb script as a brew/scoop CLI :)

littleli14:09:25

I would suggest to build super simple utility to demonstrate it

littleli14:09:40

and then maybe focusing more on the docs šŸ™‚

borkdude14:09:47

yeah, a repo in the babashka org

borkdude14:09:12

I can add you to one if you want to add scoop stuff?

borkdude14:09:06

basically your example

borkdude14:09:14

and then I can add the brew tap + recipe too

borkdude14:09:28

and then we add some CLI features but basically no useful functionality

borkdude14:09:14

I added you to a repo. feel free to push

littleli14:09:23

I'll take a look later today.

borkdude10:09:07

I made: https://github.com/babashka/neil Feel free to add a scoop for it with a .bat shim which depends on bb and preferably re-uses it

littleli13:09:57

we may need to add neil.cmd or neil.bat with command supporting windows. Then I can actually make a nice manifest with dependency and shim which just run babashka I think.

littleli13:09:27

let me make a PR

littleli13:09:55

btw I have a feeling there is something spinning up here šŸ™‚ do you plan to do a whole bunch of small useful utilities?

borkdude13:09:22

perhaps :-D

borkdude13:09:37

at least show examples of how it can be done

borkdude13:09:42

and who knows what will follow

littleli13:09:17

ok, if this should somehow spin off to a shape of a bigger thing (collection of scripts) let me know if you like to spin off a dedicated scoop bucket

borkdude13:09:37

for now it can be added to scoop-clojure I think

borkdude13:09:48

but I'm fine with adding the scoop bucket to the babashka org as well

borkdude13:09:01

let me know if you need a repo for this?

borkdude13:09:12

I'd be happy to give you full control

littleli13:09:37

let's start small

borkdude13:09:05

well the neil tool is also in a brew tap within the bb org

borkdude13:09:08

so it'd be consistent

borkdude13:09:44

won't mind if you add it to scoop-clojure for now

littleli13:09:16

I'd like to test it out in practice, there maybe some rough edges

littleli14:09:46

hmm, you may want to do (github) releases. That makes checkver + autoupdate work for you.

littleli14:09:01

it's a bit annoying for the starter

borkdude14:09:19

ok that's fine

borkdude14:09:22

I can automate this

borkdude14:09:03

I wonder if your bat file will pick up on the script in the right path?

littleli14:09:10

checkver is checking for the new version... there is also a PS script checkver.ps1 and autoupdate basically do the automatic manifest update

littleli14:09:43

it needs to be part of the .zip

littleli14:09:06

then I can make a shim which will make it accessible the same as babashka itself is available

littleli14:09:41

shim is basically a shortcut to application binary in current version

borkdude14:09:42

@UBLU3FQRZ Actually I did this for brew: https://github.com/babashka/homebrew-brew/blob/6ef53a05896337ead6adc890059b34bf7c5de268/Formula/neil.rb#L5 No need for release, you can directly get a zip from a commit

littleli14:09:56

ok, let me start with this

littleli14:09:11

but my PR checker will not allow me to go with this šŸ™‚

borkdude14:09:25

let's get a working version first

borkdude14:09:28

then we can optimize later

littleli14:09:30

I'll do manifest in my garage where this checker is not applied

littleli14:09:47

working on it

littleli14:09:40

how can I get to the specific archive link?

littleli14:09:34

oh it's based on commit sha, ok ok

littleli15:09:57

I have some progress, TTL

borkdude15:09:44

what is TTL?

borkdude15:09:47

time to leave?

littleli19:09:01

should be TTYL šŸ™‚ talk to you later

littleli19:09:00

there is a bank holiday in Czechia and I had some family errands going on

borkdude19:09:27

@UBLU3FQRZ What is a bank holiday?

littleli19:09:15

bank holiday refers to all public holiday... we have Czech Statehood day https://en.wikipedia.org/wiki/Public_holidays_in_the_Czech_Republic

littleli19:09:39

I wasn't working on this day

David Pham10:09:25

So the behavior I was seing is that I am creating a list of argument with products between two sets (for [a [1 2] b ["a" "b" "c"]] (process [a b])

David Pham10:09:06

and then process was executing the first group 1 x ["a" "b" "c] first, before executing the 2 x ["a" "b" "c].

David Pham10:09:33

I circumvent the behavior by making a flat list of arguments and then use map over that list.

David Pham10:09:41

I don't understand why that happens though.

borkdude10:09:17

could be related to laziness and not realizing this for sequence

borkdude10:09:43

usually it's not encouraged to perform side effects via lazy sequences

borkdude10:09:45

you could do println instead of process to see what happens

borkdude10:09:33

could also be related in how you dereference the processes (if you're doing that). it's hard to say without seeing the program

David Pham10:09:47

I use process/check to deref

borkdude10:09:01

process/check is waiting for the process to finish

David Pham10:09:03

Interesting šŸ™‚

borkdude10:09:18

so that will block

David Pham10:09:40

Yes, it is intended to block once the process have been launched.

denik15:09:13

@borkdude looks like babashka can not be installed on the default raspberry pi OS (formerly raspian) or is there a trick Iā€™m missing? Happy to help improve the docs also when I figure it out. https://github.com/babashka/babashka/issues/241

borkdude15:09:35

@denik bb only runs on 64bit

šŸ‘ 1
borkdude15:09:20

this is imposed by the graalvm nature of things

šŸ™ƒ 1