Skip to content
Asynchronous workers using a state machine.
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
.globality
build.python-library/docker-base
microcosm_daemon
.ackrc
.bumpversion.cfg
.dockerignore
.gitignore
.pullapprove.yml
CHANGES.md
Dockerfile.template
LICENSE
MANIFEST.in
README.md
entrypoint.sh
setup.cfg
setup.py
tox.ini

README.md

microcosm_daemon

Asynchronous workers using a state machine.

Circle CI

Conventions

  • A state machine calls a single-argument worker function in a loop:

    def func(graph):
        pass
    
    state_machine = StateMachine(graph, func)
    state_machine.run()
    
  • A worker function can return another callable to cause a state transition:

    def next_func(graph):
        pass
    
    def func(graph):
        return next_func
    
  • A worker function can raise SleepNow to cause the state machine to sleep before processing itself again:

    def func(graph):
        raise SleepNow
    
  • A worker function can raise an exception. By default, all exceptions except FatalError are swallowed by the state machine's error handler although the state machine can be made to fail fast by configuring the error policy to be strict.

You can’t perform that action at this time.