Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Change Conditions Execution Order #701

@b-butler

Description

@b-butler

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions