Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a conditional task #25

Open
haxsaw opened this issue Feb 24, 2015 · 0 comments
Open

Create a conditional task #25

haxsaw opened this issue Feb 24, 2015 · 0 comments

Comments

@haxsaw
Copy link
Owner

haxsaw commented Feb 24, 2015

We need a task that wraps one or two other tasks and a test of some kind. If the test returns True, then one task is run. If false, either nothing happens or the other task is run. Something like this:

CondTask(name, predicate, true_task, else_task=None)

where:

  • name is the conditional task name
  • predicate is a callable that takes a CallContext and returns either True or False
  • true_task is some kind of task that is run if predicate returns true
  • else_task defaults to none, but can be task that will be run if predicate is false

CondTask only fails if one of its wrapped tasks fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant