portkey

Portkey: from REPL to Serverless in one call
viesti 2018-05-03T05:16:20.000167Z

so we'd have something similar to -rest-json-call for query string protocol?

viesti 2018-05-03T05:16:39.000020Z

if not the same time but parameterized

baptiste-from-paris 2018-05-03T08:47:31.000489Z

yes

baptiste-from-paris 2018-05-03T08:47:36.000120Z

{“name” #{},
 “http” #{“method” “requestUri”},
 “input” #{“shape”},
 “output” #{“resultWrapper” “shape”},
 “errors” #{}}

baptiste-from-paris 2018-05-03T08:48:11.000118Z

and here are the keys that I found for the query protocol

baptiste-from-paris 2018-05-03T08:48:22.000371Z

errors contains some shapes representing errors

baptiste-from-paris 2018-05-03T08:49:57.000153Z

so really simplified compared to rest-json

baptiste-from-paris 2018-05-03T08:51:52.000292Z

so my goal is to translate each shape (`map` list, atomic ones) into query-string or form-params

viesti 2018-05-03T09:04:38.000439Z

if I have time, I could take a look at grabbing docs from separate files, maybe on some evening

baptiste-from-paris 2018-05-03T09:20:48.000031Z

if you can check also if everything is fine for the LATEST thing

viesti 2018-05-03T11:39:59.000392Z

yup

viesti 2018-05-03T11:40:30.000023Z

depends if our little one goes to sleep easily 🙂

cgrand 2018-05-03T12:05:08.000525Z

food for thought http://www.serverlesscomputing.org/wosc2/presentations/s2-wosc-slides.pdf

cgrand 2018-05-03T12:06:33.000061Z

>>> Takeaways • The future is granular, interactive and massively parallel. • Many applications can benefit from this “Laptop Extension” model. • Better platforms are needed to be built to support “bursty” massively-parallel jobs.

viesti 2018-05-03T12:09:11.000346Z

nodding on the last bullet

viesti 2018-05-03T12:09:35.000104Z

it’s too easy to just throw users at a database and then wonder why stuff doesn’t work performantly

baptiste-from-paris 2018-05-03T12:10:03.000225Z

In the next few weeks, it’s open-source, no deadline 🙂

cgrand 2018-05-03T12:10:24.000210Z

Could you tell more?

baptiste-from-paris 2018-05-03T12:11:26.000349Z

@cgrand is it a conférence you attended ?

cgrand 2018-05-03T12:11:58.000416Z

nope some slides I came across

baptiste-from-paris 2018-05-03T12:12:02.000453Z

ok

baptiste-from-paris 2018-05-03T12:13:28.000137Z

you are working on distributed computing ?

baptiste-from-paris 2018-05-03T12:18:53.000465Z

I really don’t understand how you can split an encoding job between 5000' thread

viesti 2018-05-03T13:04:08.000276Z

at my current project, we have this 12 node Redshift cluster

viesti 2018-05-03T13:12:31.000735Z

I have a feeling that I'm slowly morphing into a dbadmin

baptiste-from-paris 2018-05-03T14:02:07.000913Z

I have very good feedbacks on ClojuTRE

baptiste-from-paris 2018-05-03T14:02:16.000220Z

I have to go this year

viesti 2018-05-03T15:20:55.000805Z

I think 2014 was my first ClojuTRE, has been really good event every time 🙂

baptiste-from-paris 2018-05-03T15:33:02.000149Z

The attribute stuff is so uncool

viesti 2018-05-03T15:37:58.000586Z

Similar things are to watch out when using spark, but haven’t used a real distributed cluster. Would like to see a Spark cluster used with powderkeg 🙂

baptiste-from-paris 2018-05-03T15:47:39.000766Z

question, should we create different (spec/conformer) based on the protocol to format the request or use only specs globally and rework the input

baptiste-from-paris 2018-05-03T15:47:42.000644Z

e.g :

baptiste-from-paris 2018-05-03T15:47:57.000172Z

[{:topic-arn "2w",
   :label "h",
   :awsaccount-id ["8L" "" "" "" "ff"],
   :action-name ["1" "m" "n" "ne" "" "GR" "" "56" "6"]}
  {"TopicArn" "2w",
   "Label" "h",
   "AWSAccountId" ["8L" "" "" "" "ff"],
   "ActionName" ["1" "m" "n" "ne" "" "GR" "" "56" "6"]}]

baptiste-from-paris 2018-05-03T15:48:51.000460Z

this exercise on :portkey.aws.sns.-2010-03-31/add-permission-input returns vectors for the list “type”

baptiste-from-paris 2018-05-03T15:49:05.000482Z

If I read the doc well, this translate to something like that =>

baptiste-from-paris 2018-05-03T15:49:25.000956Z

<http://sns.us-east-1.amazonaws.com/>
        ?TopicArn=arn%3Aaws%3Asns%3Aus-east-1%3A123456789012%3AMy-Test
        &amp;ActionName.member.1=Publish &amp;ActionName.member.2=GetTopicAttributes
        &amp;Label=NewPermission &amp;AWSAccountId.member.1=987654321000
        &amp;AWSAccountId.member.2=876543210000 &amp;Action=AddPermission &amp;SignatureVersion=2
        &amp;SignatureMethod=HmacSHA256 &amp;Timestamp=2010-03-31T12%3A00%3A00.000Z
        &amp;AWSAccessKeyId=(AWS Access Key ID)
        &amp;Signature=k%2FAU%2FKp13pjndwJ7rr1sZszy6MZMlOhRBCHx1ZaZFiw%3D 

baptiste-from-paris 2018-05-03T15:49:45.000745Z

with ActionName.member.1=Publish &amp;ActionName.member.2=GetTopicAttributes as values

baptiste-from-paris 2018-05-03T15:50:01.000458Z

kind of the same pattern for maps

baptiste-from-paris 2018-05-03T15:55:42.000518Z

so structure, map and list are the 3 compound types

baptiste-from-paris 2018-05-03T15:56:00.000909Z

but we can exclude structure as it’s a global wrapper

viesti 2018-05-03T19:15:19.000464Z

I might be off but spec.tools has a way of changing a conformer: https://github.com/metosin/spec-tools/blob/master/README.md#spec-coercion

baptiste-from-paris 2018-05-03T19:16:11.000014Z

I wrote something like that =>

baptiste-from-paris 2018-05-03T19:16:18.000091Z

(defn conformed-input-&gt;query-protocol-input
    "Given a conformed input, transform the input to be compliant to
  the `query` protocol of AWS."
    [input]
    (into {} (for [[k v] input]
               (cond
                 (string? v) [k v]
                 (vector? v) (into {} (map-indexed (fn [i v'] [(str k ".member." i) v'])) v)
                 (map? v) (into {}
                                (comp
                                 (x/for [[k' v'] %]
                                   [[(str k ".entry.") k'] [(str k ".entry.") v']])
                                 (map-indexed (fn [i [[k1 v1] [k2 v2]]]
                                                [[(str k1 i ".key") v1] [(str k2 i ".value") v2]]))
                                 cat)
                                v)))))

baptiste-from-paris 2018-05-03T19:16:52.000183Z

I am not sure it’s the best way but it works

cgrand 2018-05-03T19:18:28.000495Z

My plan was/is to decouple spec and transformation. (Wip in my old wip branch)

baptiste-from-paris 2018-05-03T19:19:42.000636Z

you mean not use spec conformers ?

baptiste-from-paris 2018-05-03T19:20:18.000177Z

what we know is that description files are the same for the 5 protocols

baptiste-from-paris 2018-05-03T19:20:24.000472Z

so specs are working that way

baptiste-from-paris 2018-05-03T19:20:57.000266Z

but output/conforming has little differences

baptiste-from-paris 2018-05-03T19:23:24.000042Z

by the way, same goes for the output specs

baptiste-from-paris 2018-05-03T19:32:17.000459Z

does it recall you something @cgrand =>

baptiste-from-paris 2018-05-03T19:32:26.000321Z

(concat (map #(str "ser-" %) inputs) (map #(str "req&lt;-" %) input-roots)
                     (map #(str "deser-" %) outputs) (map #(str "resp-&gt;" %) output-roots))

baptiste-from-paris 2018-05-03T19:37:10.000435Z

the shape-seq makes me really nervous

baptiste-from-paris 2018-05-03T19:37:17.000221Z

😂

baptiste-from-paris 2018-05-03T19:42:18.000248Z

@cgrand when you have the time, it would be awesome of you can explain to me the overall archetecture that you were looking for

baptiste-from-paris 2018-05-03T19:42:50.000240Z

from there I can try to draw some stuff and then go back to your code