google-cloud

Google Cloud Platform: Clojure + {GAE, GCE, anything else on Google Platform}
nickbauman 2017-01-18T03:41:41.000315Z

Sure that’s a line of investigation is interesting. I was just wondering how hard it would be to simply do it in pure clojure. Allow people to pass in additional work to be done at each stage. It would be totally orthogonal to the existing API.

nickbauman 2017-01-18T03:41:59.000316Z

It’s kind of a crazy idea and it probably won’t work but maybe it could work.

nickbauman 2017-01-18T03:42:55.000317Z

pass some clojure code into macro that runs before the other stuff.

nickbauman 2017-01-18T03:42:59.000318Z

Does that make sense?

nickbauman 2017-01-18T03:43:39.000319Z

The Java SDK uses annotations because Java is such a weak language it can do what clojure can do.

2017-01-18T07:04:00.000320Z

I guess I’m not following what you mean by “pure clojure”. you mean rig up callbacks in your Clojure API, without using the Java annotations? obviously that would only work if users only ever used your Clojure API; it would not really be a datastore hook. since it’s basically trivial to register callbacks using deftype, why bother?

nickbauman 2017-01-18T14:46:06.000322Z

Because the code is ugly AF. And the annotations exist only because of the limitations of the Java language. Limitations that don't exist in Clojure.

nickbauman 2017-01-18T14:48:49.000323Z

But I probably I won't go that route anyway. It's a worthwhile thought experiment though.

2017-01-18T19:35:52.000325Z

@nickbauman check out https://github.com/technomancy/robert-hooke

nickbauman 2017-01-18T19:37:08.000327Z

@mobileink ohhh that’s actually quite beautiful!

nickbauman 2017-01-18T19:37:42.000328Z

You’re messing with my brain because now I really don’t want to use the annotations at all.

nickbauman 2017-01-18T19:37:58.000329Z

And before I saw that, I was planning to...

nickbauman 2017-01-18T19:38:06.000330Z

You’re a bad person 😉

nickbauman 2017-01-18T19:38:18.000331Z

Seriously, that’s cool.

2017-01-18T19:39:11.000332Z

you could prolly use that to hide the annotation cruft.

nickbauman 2017-01-18T19:39:48.000333Z

Sorry kinda slow in the brain.

nickbauman 2017-01-18T19:39:51.000334Z

I see that now

2017-01-18T19:40:18.000335Z

id be wary of trying to duplicate the gae callback mechanism in clj.

nickbauman 2017-01-18T19:41:17.000336Z

🤷 yeah

2017-01-18T19:41:22.000337Z

the result would inevitable be pretty fragile, methinks.

nickbauman 2017-01-18T19:41:44.000338Z

Hooks are meant to extend functions you don't control … more food for thought.

2017-01-18T19:43:42.000339Z

fragile for the post atuff, anyway. i could see using robert-hooke to intercept put ops. might be more efficient.

2017-01-18T19:50:39.000340Z

i suppose with robert-hooke we could hook any GAE method call. kinda cool.

✅ 2
2017-01-18T19:58:41.000341Z

@nickbauman you asked previously if my stuff supprts hooks. no. i havent worked on it for a while, i think they added the cb stuff after i got started, altho i would not swear to it. obviously sth that should be supported.

nickbauman 2017-01-18T20:00:43.000342Z

I’ve used hooks in the Python API extensively. I found it very useful.

nickbauman 2017-01-18T20:01:03.000343Z

(also easy to abuse, though)

2017-01-18T20:01:22.000344Z

being lazy, impatient, and hubristic, im inclined to just provide some sample code demonstrating use of deftype with method annotations.

nickbauman 2017-01-18T20:24:22.000345Z

Yeah it’s not wrong

nickbauman 2017-01-18T20:24:30.000346Z

To do that

2017-01-18T20:43:19.000347Z

regarding librarification: strong recommend. imho every gae service should be supported in a separate lib. if you do that then people can use the services with any build system. you should be able to use my datastore lib with your leinengen thingie, and i should be able to use your ds lib with my boot-gae thingie.

👍 1
fellshard 2017-01-18T21:34:49.000349Z

PCollection<KV<String, Integer>> scores = input
  .apply(Window.into(FixedWindows.of(Duration.standardMinutes(2)))
               .triggering(
                 AtWatermark()
                   .withEarlyFirings(AtPeriod(Duration.standardMinutes(1)))
                   .withLateFirings(AtCount(1)))
               .accumulatingAndRetractingFiredPanes())
  .apply(Sum.integersPerKey());
... There's gotta be a way to do this better, Google. And people complain about how Lisps use parentheses...

2017-01-18T21:54:49.000350Z

@fellshard ok. whats the connection with google cloud?

2017-01-18T22:22:59.000351Z

i'd be happy to help, i just don't know what your question is.

fellshard 2017-01-18T22:31:12.000352Z

Sorry, this was sample code from DataFlow articles. Pretty sure this is technically Apache Beam.

fellshard 2017-01-18T22:31:38.000353Z

This seems like it's a suitable case for a data-driven DSL given it's intended to be purely declarative.