portkey

Portkey: from REPL to Serverless in one call
cgrand 2017-10-07T07:54:43.000035Z

Btw I’m in the twilight zone: more logging reveals it’s my class that has extra fields… matching a jdk7 implementation while there’s no such thing on the class path.…

baptiste-from-paris 2017-10-07T14:18:40.000025Z

hello all, little update. 1) I run a little lambda/portkey that send emails to customer in prod (for real clients) 2) I have a personal objective, understanding all that is happening in portkey I am currently playing with ouroboros, just got how to attach an Angent to the running vm, next step is understanding what’s happening with transformer’s functions. Thanks you for helping me understand global design

👍 1
viesti 2017-10-07T15:07:24.000039Z

akh, we can’t loose Christophe to the twilight zone of java classes

baptiste-from-paris 2017-10-07T15:15:35.000070Z

lol

baptiste-from-paris 2017-10-07T15:20:47.000005Z

by the way, do you know why when I launch the REPL I can retrieve the VM with attach but once I try do to it in my REPL I have this error UnsatisfiedLinkError Native Library /Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home/jre/lib/libattach.dylib already loaded in another classloader java.lang.ClassLoader.loadLibrary0 (ClassLoader.java:1907)

baptiste-from-paris 2017-10-09T08:54:07.000059Z

don’t worry about this one, it’s indeed IntelliJ IDE

baptiste-from-paris 2017-10-09T08:54:20.000240Z

If I use a classic REPL, all is working great

cgrand 2017-10-09T09:03:17.000239Z

and do you know if it’s IntelliJ or Cursive (before I pester Colin)?

baptiste-from-paris 2017-10-09T12:19:26.000031Z

let me check that

baptiste-from-paris 2017-10-09T12:27:00.000112Z

but how could I really know, cursive might use instrumentation also right ?

viesti 2017-10-09T14:51:10.000226Z

hum, Colin might know where to look anyway

cgrand 2017-10-09T16:00:39.000655Z

Launch a java process with clojure.Main and the right classpath.

baptiste-from-paris 2017-10-10T08:00:44.000514Z

@cgrand sorry for the delay, it’s working great with clojure.main repl

baptiste-from-paris 2017-10-10T08:00:59.000082Z

must be a cursive “bug” or design

viesti 2017-10-10T11:35:07.000230Z

hum, ps aux while running repl from Cursive would reveal classpath generated by intellij for the subprocess, and maybe hint at what is happening

baptiste-from-paris 2017-10-10T12:27:53.000348Z

/Applications/IntelliJ IDEA CE.app/Contents/jdk/Contents/Home/jre/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=54123:/Applications/IntelliJ IDEA CE.app/Contents/bin

cgrand 2017-10-10T14:40:07.000303Z

Very useful

cgrand 2017-10-10T15:03:25.000490Z

@baptiste-from-paris could you try (Class/forName "com.sun.tools.attach.VirtualMachine") in a Cursive-sans-portkey repl?

baptiste-from-paris 2017-10-11T06:50:21.000179Z

ok, do that right now + I now have full notifications for this channel ^^

baptiste-from-paris 2017-10-11T06:52:40.000207Z

so, in a randam project clj repl WITH cursive and WITHOUT portkey, it’s working

baptiste-from-paris 2017-10-11T06:52:51.000011Z

(let [loader (.getContextClassLoader (java.lang.Thread/currentThread))
      tools-jar (java.io.File. (System/getProperty "java.home") "../lib/tools.jar")
      tools-jar-loader (java.net.URLClassLoader. (into-array [(.toURL tools-jar)]))
      [_ pid] (re-matches #"([^@]*).*" (.getName (java.lang.management.ManagementFactory/getRuntimeMXBean)))]

  (-> (Class/forName "com.sun.tools.attach.VirtualMachine" true tools-jar-loader)
      (.getMethod "attach" (into-array [String]))
      (.invoke nil (object-array [pid]))))
=> #object[sun.tools.attach.BsdVirtualMachine 0x5d8f3c00 "sun.tools.attach.BsdAttachProvider@78025dc1: 2327"]

baptiste-from-paris 2017-10-07T15:21:10.000053Z

with this one in the REPL

(-> (Class/forName "com.sun.tools.attach.VirtualMachine" true tools-jar-loader)
          (.getMethod "attach" (into-array [String]))
          (.invoke nil (object-array [pid])))

viesti 2017-10-07T15:28:50.000089Z

hmm, same native library already loaded by IntelliJ?

viesti 2017-10-07T15:29:17.000097Z

been using cider with nrepl so haven’t noticed, should try IntelliJ myselkf

baptiste-from-paris 2017-10-07T15:30:22.000053Z

worked with both, and I found out that they are both excellent tools but I really love class navigation of IntelliJ products

viesti 2017-10-07T15:30:58.000105Z

yes, I use it for Java browsing also

viesti 2017-10-07T20:12:36.000072Z

and I have to thank you also, it’s really good to have someone embarking on a journey with portkey 🙂

baptiste-from-paris 2017-10-07T20:20:52.000021Z

thx ^^

baptiste-from-paris 2017-10-07T20:25:16.000079Z

But the road will be long for me ^_^

viesti 2017-10-07T21:00:13.000068Z

whoa, was looking at creating unmount! and undeploy! to have tests that actually hit api gateway, so that I can be a bit more certain on my code that uses aws, and for this I’d need to clean after test and maybe users would wan’t to clean mounts as well. Now that I say this, for tests I probably could just remove the whole API, but there was a limit on API deletions per minute that I hit quite easily http://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html, which is 2 per minute. Then again this could be done after running all tests.

viesti 2017-10-07T21:00:55.000020Z

anyways, had a problem with aws-clj-sdk (apigw/get-resources) returning only first 25 items and I have more deployed

viesti 2017-10-07T21:03:59.000020Z

reading the code (https://github.com/portkey-cloud/aws-clj-sdk/blob/master/src/portkey/aws.clj#L216), figured out that I can just pass query parameters of the actual rest api (https://docs.aws.amazon.com/apigateway/api-reference/link-relation/restapi-resources/) in the body, like (apigw/get-resources {:rest-api-id "xxxx" :limit 100})

viesti 2017-10-07T21:11:00.000016Z

hmm, the link tracing for pagination though…

cgrand 2017-10-07T21:34:35.000108Z

“In another class loader” is an interesting twist. Open issue please.