Created
April 18, 2017 18:53
-
-
Save harlowja/aeec4ca758f69e9c27c821d71b00a860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
logging.basicConfig(level=5) | |
from taskflow import engines as eng | |
from taskflow.patterns import linear_flow as lf | |
from taskflow import task | |
class MyTask(task.Task): | |
def execute(self): | |
raise ValueError('foo') | |
def revert(self, *a, **k): | |
raise ValueError('bar') | |
class HappyTask(task.Task): | |
def execute(self): | |
pass | |
def revert(self, *a, **k): | |
print("undoing") | |
flo = lf.Flow("test") | |
flo.add(HappyTask()) | |
flo.add(MyTask()) | |
eng.run(flo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment