Skip to content

Add ability to create custom trigger rules through plugins #10758

@maiorBoltach

Description

@maiorBoltach

Description

Create API fro creating new types of different trigger_rules like it's done for macros or views.

Use case / motivation

Currently, there are 8 different types of rules for triggering subsequent tasks, but they do not allow you to flexibly set more complex rules for the entire pipeline (not from the point of view of business requirements for a dagger, but technical ones).
For example, at the moment there is only 1 rule (all_done), which waits for all upstream tasks to finish. It is impossible to implement, for example, the following rule without complications:

[task1, task2, task3] >> task4.
Task 4 should be triggered if all tasks are done and one success.

We have to create more complicated dags:
[task1, task2, task3] >> check_task (all_done trigger_rule) >> task_4 .
check_task - python_operator, that checks all upstream tasks statuses. If there're all upstream task failed, task will raise new AirflowException to pass upstream_failed to task_4.

As you see, that's very simple example, but it require complicate solution.
There are more different cases like 'two_success' and different combinations with 'all done'

Related Issues

#1432

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