airflow.operators.weekday

Module Contents

Classes

BranchDayOfWeekOperator

Branches into one of two lists of tasks depending on the current day.

class airflow.operators.weekday.BranchDayOfWeekOperator(*, follow_task_ids_if_true, follow_task_ids_if_false, week_day, use_task_execution_day=False, **kwargs)[source]

Bases: airflow.operators.branch.BaseBranchOperator

Branches into one of two lists of tasks depending on the current day. For more information on how to use this operator, take a look at the guide: BranchDayOfWeekOperator

Parameters
  • follow_task_ids_if_true (Union[str, Iterable[str]]) – task id or task ids to follow if criteria met

  • follow_task_ids_if_false (Union[str, Iterable[str]]) – task id or task ids to follow if criteria does not met

  • week_day (Union[str, Iterable[str]]) –

    Day of the week to check (full name). Optionally, a set of days can also be provided using a set. Example values:

    • "MONDAY",

    • {"Saturday", "Sunday"}

    • {WeekDay.TUESDAY}

    • {WeekDay.SATURDAY, WeekDay.SUNDAY}

  • use_task_execution_day (bool) – If True, uses task’s execution day to compare with is_today. Execution Date is Useful for backfilling. If False, uses system’s day of the week.

choose_branch(self, context)[source]

Subclasses should implement this, running whatever logic is necessary to choose a branch and returning a task_id or list of task_ids.

Parameters

context (airflow.utils.context.Context) – Context dictionary as passed to execute()

Was this entry helpful?