有没有办法暂停气流DagRun?

时间:2019-04-29 18:08:21

标签: airflow

是否可以在Airflow中暂停特定的DagRun?

我希望能够同时执行单个DAG的多个运行,并且希望能够在某些时候分别暂停这些运行。

取消暂停/暂停功能似乎仅在DAG级别上起作用,并且暂停/取消执行所有(针对该DAG的)DagRun。

我希望能够执行此操作,因为我想执行一些长时间运行的异步任务,并且不想雇用正在运行无限传感器的工作人员,所以我想创建一个任务会暂停dag,而其他一些操作(例如API调用)将取消暂停dag的运行。

1 个答案:

答案 0 :(得分:0)

如果这是关于传感器的,那么您很幸运,因为该解决方案已在1.10.2版中实现:https://issues.apache.org/jira/browse/AIRFLOW-2747

:param mode: How the sensor operates.
    Options are: ``{ poke | reschedule }``, default is ``poke``.
    When set to ``poke`` the sensor is taking up a worker slot for its
    whole execution time and sleeps between pokes. Use this mode if the
    expected runtime of the sensor is short or if a short poke interval
    is requried.
    When set to ``reschedule`` the sensor task frees the worker slot when
    the criteria is not yet met and it's rescheduled at a later time. Use
    this mode if the expected time until the criteria is met is. The poke
    interval should be more than one minute to prevent too much load on
    the scheduler.

来源:https://github.com/apache/airflow/blob/e62ad5333cbb56ae0f2001f0f79008a21c41a983/airflow/sensors/base_sensor_operator.py#L46