Tasks added to DAG during runtime fail to be scheduled

前端 未结 1 1161
遥遥无期
遥遥无期 2021-01-15 03:16

My idea is to have a task foo which generates a list of inputs (users, reports, log files, etc), and a task is launched for every element in the input list. The

1条回答
  •  借酒劲吻你
    2021-01-15 03:40

    At this point in time, airflow does not support adding/removing a task while the dag is running.

    The workflow order will be whatever is evaluated at the start of the dag run.

    See the second paragraph here.

    This means you cannot add/remove tasks based on something that happens in the run. You can add X tasks in a for loop based on something not related to the run, but after the run has begun there is no changing the workflow shape/order.

    Many times you can instead use a BranchPythonOperator to make a decision during a dag run, (and these decisions can be based on your xcom values) but they must be a decision to go down a branch that already exists in the workflow.

    Dag runs, and Dag definitions are separated in airflow in ways that aren't entirely intuitive, but more or less anything that is created/generated inside a dag run (xcom, dag_run.conf, etc.) is not usable for defining the dag itself.

    0 讨论(0)
提交回复
热议问题