goodboy / tractor

A distributed, structured concurrent runtime for Python (and friends)
GNU Affero General Public License v3.0
265 stars 12 forks source link

All the tutorials: we need motivating (advanced) examples in our docs #175

Open goodboy opened 3 years ago

goodboy commented 3 years ago

Clearly, we need some fancier and more immediately practical examples in our readme (says every person who's glanced ever), so I figured I'd start list of what I think would be coolio.


A "worker pool" example copying concurrent.futures's prime number calculator


The multiprocessing.Pool examples:


A "controlled fork blast" example


A real-time streaming sorting algorithm


Target tutorial set:

this is the back of hand list I can think of:


Lurker opinions always welcome.

We might actually need to pick the best of these and then stick the rest in a parallelism tutorial. Actually, we might want a streaming, shared state, and parallelism tutorial in the new docs.

parity3 commented 3 years ago

Wow, some of these, particularly the stream sorting may do well as their own separate repos/libraries!

Another possible example is to implement one of the function-as-a-service protocols with some tuning goodies.

goodboy commented 3 years ago

Another possible example is to implement one of the function-as-a-service protocols with some tuning goodies.

@parity3 sweet idea. I'd welcome a PR for something that too 😉

function-as-a-service

Also check #182, I think the caps based RPC is going to be here to stay the more I've thought about it. I actually have been dreaming up auto-generating capn proto schema from python's type annotations.

parity3 commented 3 years ago

Another piece of code that may be nice to see is for a tractor controller app to run as a daemon that some other sync or polyglot app could call into, and be used as a glorified task queue implementation. You could make it compatible with celery or dramatiq or whatever.

goodboy commented 3 years ago

You could make it compatible with celery

I was gonna say, IMO if you pair tractor with nanomessage or zeromq you can pretty much implement celery somewhat trivially, but it'll be rabbitmq free / tractor broker kinda thing.

That might be good further down the line to demonstrate how with the right primitives from the outset these specialized message pattern designs like celery (which AMQP is just a special case of something you can build with brokerless based scalability protocols and/or an actor model) are super easy to create without a giant slew of components / configuration.

This was kind of always the intention from the outset: make the zeromq of micro-service systems showing how most message oriented designs are just special cases if you start with the right primitives. This will be extended by theory around security principles from capability based sec and how you can build ultra-resilient supervisor trees with this approach.

goodboy commented 3 years ago

Hmm probably worth linking celery/ceps#27

goodboy commented 3 years ago

@parity3 yeah maybe a "micro-service design" tutorial is in order as well.

I think we'll end up picking the simplest / hippest of these examples and toss the rest in a "parallelism tutorial" in the docs.