If
Marks a task method whose boolean picks one of two tasks; the other is skipped.
The method is an ordinary task method that returns boolean. Its wiring-view method returns a ConditionRef rather than a TaskRef, so each side is named where the Dag is wired:
@Airflow.If(id = "has_rows")
public boolean hasRows(long rows) { return rows > 0; }
@Airflow.Deps
static class Wiring implements EtlDeps {
void depends() { hasRows(extract()).Then(load()).Else(reportEmpty()); }
}The condition skips only the side not taken, so a task that runs after both sides needs a trigger rule that tolerates one skipped upstream, such as none_failed_min_one_success.
Configuration attributes are Task's, and apply to the deciding task.
Properties
Airflow's depends_on_past setting.
Airflow's do_xcom_push setting.
Airflow's email_on_failure setting.
Airflow's email_on_retry setting.
Airflow's execution_timeout setting; an ISO-8601 duration such as "PT5M".
Airflow's ignore_first_depends_on_past setting.
Airflow's map_index_template setting.
Airflow's max_active_tis_per_dag setting.
Airflow's max_active_tis_per_dagrun setting.
Airflow's max_retry_delay setting; an ISO-8601 duration such as "PT5M".
Airflow's priority_weight setting.
Airflow's retry_delay setting; an ISO-8601 duration such as "PT5M".
Airflow's retry_exponential_backoff setting.
Airflow's trigger_rule setting.
Airflow's wait_for_downstream setting.
Airflow's wait_for_past_depends_before_skipping setting.
Airflow's weight_rule setting.