Skip to main content

Yet another finite state machine with memory and callbacks.

Project description

alt logo


pip install marmoolak


import marmoolak
marmoolak.REDIS_HOST = ''
marmoolak.REDIS_PORT = 6379
machine = marmoolak.Machine

def onpanic(e):
    print('panic! ' + e.msg)
def oncalm(e):
    print('thanks to ' + e.msg + ' done by ' + e.args[0])
def ongreen(e):
def onyellow(e):
def onred(e):

fsm = machine('myname', 'version1' , {'initial': 'green',
             'events': [
                 {'name': 'warn', 'src': 'green', 'dst': 'yellow'},
                 {'name': 'panic', 'src': 'yellow', 'dst': 'red'},
                 {'name': 'panic', 'src': 'green', 'dst': 'red'},
                 {'name': 'calm', 'src': 'red', 'dst': 'yellow'},
                 {'name': 'clear', 'src': 'yellow', 'dst': 'green'}],
             'callbacks': {
                 'onpanic': onpanic,
                 'oncalm': oncalm,
                 'ongreen': ongreen,
                 'onyellow': onyellow,
                 'onred': onred }})

fsm.panic(msg='killer bees', url="")
fsm.calm('bob', msg='sedatives in the honey pots')


I used fysom and redis for achiving this functionality. So most of the credit goes to redis and fysom developers.

Contact me

Feel free to drop me a mail at

Project details

Download files

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

Files for marmoolak, version 1.0.8
Filename, size File type Python version Upload date Hashes
Filename, size marmoolak-1.0.8-py2-none-any.whl (4.7 kB) File type Wheel Python version 2.7 Upload date Hashes View
Filename, size marmoolak-1.0.8-py3-none-any.whl (4.7 kB) File type Wheel Python version 3.5 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page