Fault-tolerance framework Py-Fate 1.4 released

dmitry at targeted.org dmitry at targeted.org
Sat Sep 2 12:23:59 CEST 2006


Fault-tolerance framework Py-Fate contains several proxy classes and/or
algorithms so that a conscious developer can easily add fault-tolerance
to the code.

http://sourceforge.net/projects/py-fate/

The biggest point is that Python proxying capabilities allow for
invisible drop-in addition or revocation of fault tolerance. Using
Py-Fate you can turn any callable into a syntactically identical
callable with fault-tolerant twist, for example:

---------------------------------------------------

"Sequential" fault-tolerance through repetition:

def foo(...):
    ...

foo(...) # regular foo call

foo = ft_retry(ft_sync(foo), 3)
foo(...) # now foo gets retried up to 3 times in case it throws

foo = ft_retry(ft_async(foo, 10.0), 3)
foo(...) # same but each retry of foo also times out in 10 seconds

foo = ft_retry_backoff(ft_async(foo, 10.0), 1.0, 3)
foo(...) # same but exponentially increasing sleep is inserted between
the retries, exactly 1, 2, and 4 seconds in this example

---------------------------------------------------

"Parallel" fault-tolerance through simultaneous execution of multiple
variants of the same code:

def foo1(...):
    ...

def foo2(...): # has the same signature as foo1
    ...

foo = ft_par_1st(ft_succeeded, ft_sync(foo1), ft_sync(foo2))
foo(...) # runs foo1 and foo2 in parallel and whichever returns first
and manages not to throw wins

def foo3(...): # has the same signature as both the other foo's
    ...

foo = ft_par(ft_majority_voter(), ft_sync(foo1), sync(foo2),
sync(foo3))
foo(...) # runs all three in parallel and performs majority voting on
the results

foo = ft_par_tb(ft_equal_comparator(), ft_sync(foo1), sync(foo2),
sync(foo3))
foo(...) # similar to the previous but doesn't wait for all the foo's
to return as soon as there is enough identical votes

Obviously, there is a handful other templates and more details, please
see the module documentation.

---------------------------------------------------

Please download Py-Fate here:
http://sourceforge.net/projects/py-fate/



More information about the Python-announce-list mailing list