Skip to main content

Framework for writing distributed, fault tolerant and scalable applications

Project description

Overview

Spinoff is a framework for writing distributed, fault tolerant and scalable applications in Python. Spinoff is based on the Actor Model and borrows from Akka (location transparency, actor references, etc) and Erlang (processes, nodename@hosthost style node references (not implemented yet)).

Spinoff has been built using Twisted as the underlying framework and ZeroMQ (via pyzmq and a fork of txzmq) for remoting.

Spinoff is currently under continuous development but is nevertheless usable for writing real applications—its fault tolerance features also protect it against bugs in its own code.

Example

The following is only a very small “peek preview” style example of what the framework can do. More examples and full documentation will follow soon.

# spinoff/examples/example1.py

from spinoff.actor import Actor
from spinoff.actor.process import Process
from spinoff.util.logging import dbg
from spinoff.util.async import sleep, with_timeout


class ExampleProcess(Process):
    def run(self):
        child = self.spawn(ExampleActor)

        while True:
            dbg("sending greeting to %r" % (child,))
            child << ('hello!', self.ref)

            dbg("waiting for ack from %r" % (child,))
            yield with_timeout(5.0, self.get('ack'))

            dbg("got 'ack' from %r; now sleeping a bit..." % (child,))
            yield sleep(1.0)


class ExampleActor(Actor):
    def pre_start(self):
        dbg("starting")

    def receive(self, msg):
        content, sender = msg
        dbg("%r from %r" % (content, sender))
        sender << 'ack'

    def post_stop(self):
        dbg("stopping")

The example can be run using the following command:

twistd --nodaemon startnode --actor spinoff.examples.example1.ExampleProcess

Project details


Release history Release notifications

History Node

0.7.18

History Node

0.7.17

History Node

0.7.16

History Node

0.7.15

History Node

0.7.14

History Node

0.7.13

History Node

0.7.12

History Node

0.7.11

History Node

0.7.10

History Node

0.7.9

History Node

0.7.8

History Node

0.7.7

History Node

0.7.6

History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7

History Node

0.6.13

History Node

0.6.12

History Node

0.6.11

History Node

0.6.10

History Node

0.6.9

History Node

0.6.8

History Node

0.6.7

History Node

0.6.6

History Node

0.6.4

History Node

0.6.3

History Node

0.6.2

History Node

0.6.1

History Node

0.6

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.3

This version
History Node

0.5.2

History Node

0.5.1

History Node

0.5

History Node

0.4.1

History Node

0.4dev

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
spinoff-0.5.2.tar.gz (77.9 kB) Copy SHA256 hash SHA256 Source None Nov 9, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page