Fork me on GitHub
#portkey2017-04-28
>
cgrand12:04:01

Ok so I have made a decision between .jar or .zip

cgrand12:04:22

.zip because it allows embedding deps as is (no need to unpack and repack or to have a clustom classloader)

cgrand12:04:31

for those new to the project: it’s not working yet.

cgrand12:04:12

what’s working: serialization/deserialization of the lambda and computation of the deps

cgrand12:04:25

For example serializing

(def stub
   (reify com.amazonaws.services.lambda.runtime.RequestStreamHandler
     (handleRequest [_ in out ctx]
       (prn in out ctx))))
computes that only 4 interfaces are needed out of the AWS sdk so only these classes will be sent

cgrand14:04:16

I haven’t tested yet (alpha testers welcome!) but portkey now produces things resembling a deployment package:

cgrand14:04:35

Clojure 1.9.0-alpha15
user=> (require ‘[portkey.core :as pk])
Preparing for self instrumentation.
Ouroboros succesfully eating its own tail!
Instrumenting clojure.lang.Var... done!
nil
user=> (pk/package! “prn.zip” prn)
“prn.zip”

cgrand14:04:57

and

$ ls -lh prn.zip
-rw-r--r--  1 christophe  staff   4,5M 28 avr 16:12 prn.zip

cgrand14:04:04

(clojure alone is 4.1M)

cgrand14:04:59

and

$ unzip -t prn.zip Archive:  prn.zip
    testing: bootstrap.kryo           OK
    testing: com/                     OK
    testing: com/amazonaws/           OK
    testing: com/amazonaws/services/   OK
    testing: com/amazonaws/services/lambda/   OK
    testing: com/amazonaws/services/lambda/runtime/   OK
    testing: com/amazonaws/services/lambda/runtime/Client.class   OK
    testing: com/amazonaws/services/lambda/runtime/ClientContext.class   OK
    testing: com/amazonaws/services/lambda/runtime/CognitoIdentity.class   OK
    testing: com/amazonaws/services/lambda/runtime/Context.class   OK
    testing: com/amazonaws/services/lambda/runtime/LambdaLogger.class   OK
    testing: com/amazonaws/services/lambda/runtime/RequestStreamHandler.class   OK
    testing: lib/                     OK
    testing: lib/asm-5.0.3.jar        OK
    testing: lib/carbonite-1.4.0.jar   OK
    testing: lib/chill-java-0.3.5.jar   OK
    testing: lib/clojure-1.9.0-alpha15.jar   OK
    testing: lib/kryo-2.21.jar        OK
    testing: lib/kryo-3.0.3.jar       OK
    testing: lib/minlog-1.2.jar       OK
    testing: lib/minlog-1.3.0.jar     OK
    testing: lib/objenesis-2.1.jar    OK
    testing: lib/reflectasm-1.07-shaded.jar   OK
    testing: lib/reflectasm-1.10.1.jar   OK
    testing: portkey/                 OK
    testing: portkey/LambdaStub.class   OK
    testing: portkey/SerializerStub.class   OK
    testing: portkey/kryo.clj         OK
    testing: portkey/logdep.clj       OK
No errors detected in compressed data of prn.zip.

cgrand14:04:17

oh and btw (pk/package! "prn.zip" prn) makes no sense for a real lambda

cgrand14:04:00

doc:

user=> (doc pk/package!)
-------------------------
portkey.core/package!
([out f])
  Writes f as AWS Lambda deployment packge to out.
   f must be a function of 3 arguments: input, output and context. (See RequestHandler)