holy-lambda

viesti 2021-04-21T09:44:41.000200Z

@viesti has joined the channel

viesti 2021-04-21T09:45:03.000400Z

馃憢

Karol W贸jcik 2021-04-21T09:46:30.000600Z

Hello 馃槃

Karol W贸jcik 2021-04-21T09:47:13.001400Z

Good to see you guys 馃檪 Let me know whether there is something we can do in holy-lambda to improve it 馃檪

viesti 2021-04-21T09:47:47.002100Z

Thought that I missed the channel, but not with that many days 馃槃

Eugene Koontz 2021-04-21T09:48:47.002400Z

@ekoontz has joined the channel

viesti 2021-04-21T09:51:09.003900Z

Neat to see the effort, been thinking that JVM/Clojure support in Lambda is a good thing and I like the JVM/Runtime -> native-image progression

viesti 2021-04-21T09:52:24.004500Z

I guess there could be progression levels, from babashka to jvm runtime to native-image even, but yeah

Karol W贸jcik 2021-04-21T10:09:35.005500Z

Actually making a babashka runtime would be fairly easy on holy-lambda side.

Karol W贸jcik 2021-04-21T10:10:02.006Z

Maybe that's something that could potentially bring more people into the project

Karol W贸jcik 2021-04-21T10:10:55.006300Z

Does babashka supports namespaces?

Karol W贸jcik 2021-04-21T10:15:26.007300Z

Ok let me know whether I understand it correctly, but it seems that all I would have to do is to provide babashka pod

Karol W贸jcik 2021-04-21T10:16:29.008Z

Wondering if babashka supports defmacro though

viesti 2021-04-21T10:17:20.008500Z

0% bb
Babashka v0.3.5 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.

user=> (defmacro foo [x] 1)
#'user/foo
user=> (foo 42)
1
dummy example though 馃檪

Karol W贸jcik 2021-04-21T10:17:36.009Z

Wonderful

Karol W贸jcik 2021-04-21T10:17:50.009700Z

I want to keep functionality parity between runtimes.

viesti 2021-04-21T10:17:56.009900Z

babashka supports namespaces also, I think all in all a lot of Clojure things, but there are exceptions, like deftype , since that is low level facility to generate a class

viesti 2021-04-21T10:19:33.011400Z

holy-lambda has that polling loop also, to support the custom runtime

viesti 2021-04-21T10:20:16.012200Z

so I guess the thing would be that if the interface that holy-lambda provides for writing code against, is supported via babashka too

Karol W贸jcik 2021-04-21T10:20:48.012800Z

You can make an issue on the repository 馃檪 Would love to support babashka as well 馃檪

viesti 2021-04-21T10:20:59.013100Z

ah, true 馃檪

Karol W贸jcik 2021-04-21T10:21:30.013900Z

I will implement it probably on weekend since I'm working student 馃槥

馃槄 1
viesti 2021-04-21T10:21:40.014200Z

a babashka lambda could be packaged with docker container format even, like that example by Lukaz https://clojurians.slack.com/archives/CLX41ASCS/p1618416923161500

Karol W贸jcik 2021-04-21T10:23:11.015400Z

Ahh. Does aws lambda supports custom docker images now? I'm not aware of it

viesti 2021-04-21T10:23:23.015600Z

ah and forgot that https://github.com/dainiusjocas/babashka-lambda that you linked in the docs too

viesti 2021-04-21T10:24:07.016600Z

yeah, haven't tried out what limits there are, but Lambda supports OCI images now: https://docs.aws.amazon.com/lambda/latest/dg/images-create.html > AWS provides a set of open-source聽https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-images-lp聽that you can use to create your container image. These base images include a聽https://docs.aws.amazon.com/lambda/latest/dg/runtimes-images.html#runtimes-api-client聽to manage the interaction between Lambda and your function code.

Karol W贸jcik 2021-04-21T10:24:41.017900Z

On holy-lambda side things are very simple. All I have to do is babashka-pod. Entrypoint is the same 馃檪

viesti 2021-04-21T10:25:07.018500Z

not sure about pod actually

Karol W贸jcik 2021-04-21T10:25:45.019800Z

Meh. Not interested in packaging lambda in docker image. Zip is better imho. 馃槃

Karol W贸jcik 2021-04-21T10:26:21.020600Z

This is exactly what I'm doing: https://github.com/dainiusjocas/babashka-lambda/blob/master/src/lambda/core.clj

viesti 2021-04-21T10:26:57.021700Z

babashka pod is a subprocess that babashka can run. I think the ideas is to package stuff that can't be run with the babashka interpreter into a pod, and then use it. Allows to keep the babashka binary itself small, and extend it via the pod subprocess

Karol W贸jcik 2021-04-21T10:27:04.021900Z

This will generate the format consumable via babashka: https://github.com/FieryCod/holy-lambda/blob/master/src/fierycod/holy_lambda/native_runtime.clj#L93

viesti 2021-04-21T10:28:01.022600Z

hmm, right

Karol W贸jcik 2021-04-21T10:28:03.022800Z

That's wonderful approach. That way I can package babashka-holy-lambda pod as an aws layer. Zip will include just a source code for a project

viesti 2021-04-21T10:29:37.023900Z

hum, was also thinking that could entrypoint generate something that bb interpreter could run directly? :)

viesti 2021-04-21T10:30:32.024900Z

thinking https://book.babashka.org/#_reader_conditionals

viesti 2021-04-21T10:31:31.026400Z

thing then is that bb code might not be able to run all that java code runs, but one might be able to branch with reader conditionals

viesti 2021-04-21T10:32:24.027200Z

thinking that if there's reader conditional over say, bb aws pod, then you could load the java library in jvm/graal, and the pod in bb code (https://github.com/babashka/pod-babashka-aws)

viesti 2021-04-21T10:32:42.027800Z

but haven't looked at holy-lambda "interface" that much yet 馃檪

viesti 2021-04-21T10:33:48.028800Z

vomiting ideas here a bit 馃檪

Karol W贸jcik 2021-04-21T10:35:00.029800Z

Entrypoint generates a main function which is automatically called in bootstrap-native. The thing holy-lambda should provide is just a pod. Of course if it's possible to pack defmacro in a pod, which I now doubt.

viesti 2021-04-21T10:39:20.030300Z

馃憤 on asking on bb channel, there's good set of brains there 馃檪

viesti 2021-04-21T10:40:03.031100Z

I guess I was thinking that could it be possible, that the whole code that is written with the holy-lambda "interface", could be runnable via bb

viesti 2021-04-21T10:40:53.032100Z

in which case, I guess the lambda would start by calling bb with that piece of code, which would then run the polling loop etc

viesti 2021-04-21T10:41:33.032700Z

if I understood it correctly that you meant to provide babashka itself as a pod, might have gotten it wrong 馃檪

Karol W贸jcik 2021-04-21T10:44:59.034Z

I mean that holy-lambda is so simple that if I provide holy-lambda pod then all the boostrap-native will do is:

bb some-file-which-defines-entrypoint.clj

viesti 2021-04-21T10:48:31.034200Z

yeah, exactly 馃檪

viesti 2021-04-21T10:48:59.034700Z

what would be in the holy-lambda pod?

Karol W贸jcik 2021-04-21T10:49:57.035100Z

Hmm.. Wait...

Karol W贸jcik 2021-04-21T10:50:57.036500Z

Maybe we can do this without making another repository. Maybe I can just use those reader_conditionals.

Karol W贸jcik 2021-04-21T10:59:51.036900Z

@viesti is metosin interested in providing babashka pod?

viesti 2021-04-21T11:00:15.037400Z

hmm so babashka calls pods, not the other way around 馃檪

Karol W贸jcik 2021-04-21T11:00:31.038Z

I mean jsonista pod

Karol W贸jcik 2021-04-21T11:00:32.038300Z

馃槃

viesti 2021-04-21T11:00:49.039Z

bb includes cheshire already

Karol W贸jcik 2021-04-21T11:00:59.039400Z

I can pack holy-lambda with jsonista into native image, but I would rather not.

viesti 2021-04-21T11:01:06.039600Z

haven't tried if jsonista runs with bb actually

viesti 2021-04-21T11:01:25.040200Z

but probably ~same classes used from jackson

Karol W贸jcik 2021-04-21T11:01:33.040600Z

Jsonista has to be registered in a pod. https://github.com/babashka/pod-registry

viesti 2021-04-21T11:01:34.040800Z

might miss some classes

viesti 2021-04-21T11:01:38.041100Z

aa

viesti 2021-04-21T11:01:41.041300Z

didn't know 馃檪

viesti 2021-04-21T11:02:13.042200Z

much stuff happening in and around metosin, don't know all the things 馃檪

viesti 2021-04-21T11:02:46.043Z

ah, misread

viesti 2021-04-21T11:02:54.043500Z

jsonista not registered as pod

viesti 2021-04-21T11:03:13.044100Z

should not be needed as a pod

viesti 2021-04-21T11:03:38.045Z

if you have time to provide PR for jsonista reflection hints, it's all good 馃槈

Karol W贸jcik 2021-04-21T11:03:41.045100Z

I will put it clear. Pod is just a library compiled with native-image which in main provides some additional functionality. I can do the following: Create fierycod.holy-lambda.pod and expose all the necessary vars for babashka runtime. Register it as a pod, but jsonista is then compiled with holy-lambda.

Karol W贸jcik 2021-04-21T11:04:21.045800Z

Babashka can run libraries not packaged as pods?

viesti 2021-04-21T11:04:34.046100Z

it can run code from jars

Karol W贸jcik 2021-04-21T11:04:42.046500Z

Whaat?

viesti 2021-04-21T11:04:46.046800Z

it can use normal java classpath, load code from jars

Karol W贸jcik 2021-04-21T11:05:16.048Z

So why I want to create babashka pod XD?

viesti 2021-04-21T11:05:28.048400Z

if the clojure code in a jar users form that generate calls to JVM that are supported by babashka, that code will run

viesti 2021-04-21T11:05:33.048600Z

yep

viesti 2021-04-21T11:05:37.048800Z

that I was wondering 馃檪

Karol W贸jcik 2021-04-21T11:05:41.049100Z

XDD

viesti 2021-04-21T11:05:48.049500Z

why a holy-lambda pod :)

viesti 2021-04-21T11:05:54.049800Z

but it's all good

viesti 2021-04-21T11:06:00.050200Z

talking out loud, getting ideas etc 馃檪

Karol W贸jcik 2021-04-21T11:06:52.051600Z

Ok I think it clicks in my mind now. I will get rid of reflections in jsonista.

viesti 2021-04-21T11:06:59.052Z

thank you 馃檪

viesti 2021-04-21T11:08:51.053Z

thinking that could just try running that example (https://github.com/FieryCod/holy-lambda#example) with bb, and see what fails and plug in stuff to make it work with babashka 馃檪

viesti 2021-04-21T11:09:05.053600Z

deployment will be different per each runtime though

viesti 2021-04-21T11:09:25.054200Z

keeping that simple will require some effort

Karol W贸jcik 2021-04-21T11:09:27.054400Z

Yep. But I will hack it somehow in makefile

viesti 2021-04-21T11:09:53.054900Z

have forgotten all about make but that file based dependency thing is actually neat 馃檪

Karol W贸jcik 2021-04-21T11:10:32.055200Z

File based dependency?

viesti 2021-04-21T11:11:26.055900Z

like target/output.jar -> rule to create target/output.jar

viesti 2021-04-21T11:11:50.056500Z

https://github.com/FieryCod/holy-lambda/blob/master/docker/ce/Dockerfile#L7-L33, this made me wonder that had you already thought about docker image deployment for Lambda, but I guess not 馃檪

Karol W贸jcik 2021-04-21T11:12:49.056900Z

It's for compiling lambda.

viesti 2021-04-21T11:14:02.057900Z

ah hmm

Karol W贸jcik 2021-04-21T11:14:23.058500Z

Native compiled lambda needs only scratch image AFAIK.

Karol W贸jcik 2021-04-21T11:15:24.059200Z

So something lke:

FROM scratch

COPY output .

ENTRYPOINT ['/boostrap-native']

viesti 2021-04-21T11:28:24.059500Z

mm yeah

Karol W贸jcik 2021-04-21T11:31:25.060200Z

@viesti Very funny. But after installing locally jsonista reflections are gone.

Karol W贸jcik 2021-04-21T11:31:59.060600Z

@viesti https://github.com/metosin/jsonista/commit/90f447aac858a18194dcd95f01ca40062f41866f You just have to deploy a new release 馃槃

viesti 2021-04-21T11:33:01.060800Z

aa, hehe, neat 馃檪

viesti 2021-04-21T11:33:26.061400Z

faint memory there being improvements on type hints lately

viesti 2021-04-21T11:33:30.061600Z

but forgot

viesti 2021-04-21T11:49:41.062200Z

on jsonista, I'm a bit new with out release processes, but I'll ask around 馃檪

viesti 2021-04-23T13:43:28.091300Z

so rigged my local clojars config with help of the guys here and managed to put out 0.3.2 of jsonista, with the ObjectMapper type hint, so should compile better with Graal/native-image now 馃檪 @karol.wojcik

Karol W贸jcik 2021-04-23T13:56:22.092900Z

Lovely @viesti! Today i will roll out new version of holy lambda with babashka layer and jsonista 0.3.2

馃憤 1
Karol W贸jcik 2021-04-23T14:19:41.095Z

It makes me smile that AWS author cannot have polish letters. What a shame :D

viesti 2021-04-21T11:49:54.062500Z

another thing actually that I had in mind is tools.deps support

viesti 2021-04-21T11:50:07.062900Z

would have to have step to AOT compile

Karol W贸jcik 2021-04-21T12:02:58.063300Z

Feel free to create an issue 馃檪

鉁旓笍 1
2021-04-21T16:00:47.063900Z

@thegeez has joined the channel

馃憢 1
2021-04-21T16:58:34.064200Z

@dcj has joined the channel

Karol W贸jcik 2021-04-21T18:37:27.064500Z

Question: Should we support node.js as well? 馃槃 Edit: I had to provide some #(:cljs) conditionals so that cljdoc would pass the build and i have realized that support for nodejs could be easily added.

Karol W贸jcik 2021-04-21T21:32:24.072800Z

Braindump Babashka layer would consist of babashka (bb), holy-lambda-babashka (jar) (still need to patch jsonista functions though), clojure 1.10.0 (jar) User will have the layer referenced via ARN. Deployment artifact will consist of plain sources packed in .jar. This way we will keep deploy artifacts super small. No clojure, no babashka just sources (like in php 馃槀).