-
Notifications
You must be signed in to change notification settings - Fork 38
Change Conditions Execution Order #701
Description
Description
Currently we execute operation decorators from outside in or top bottom. This is confusing when using decorators as functions directly.
@FlowProject.operation
def op(job):
pass
FlowProject.pre(expesive_cond)(FlowProject.pre.true("foo")(op))
This actually runs the expensive computation first. This is to make this
@FlowProject.pre.true("foo")
@FlowProject.pre(expensive_cond)
@FlowProject.operation
def op(job):
pass
more intuitive. However, I disagree that this is more intuitive. As someone learns Python in fact this begins to become less and less intuitive to the point that without our documentation suggesting the correct ordering, a Python expert would write,
@FlowProject.pre(expensive_cond)
@FlowProject.pre.true("foo")
@FlowProject.operation
def op(job):
pass
Given our recent decorator ordering requirements we are already making users come to understand decorators apply bottom to top.
Suggestion
I think we should apply conditions in the order they come in the execution (i.e. bottom to top). As an irrelevant side note this would make the project definition run faster.