【发布时间】:2018-12-05 10:06:03
【问题描述】:
我已经实现了运行单个 dag 的测试用例,但它似乎在 1.9 中不起作用,可能是由于气流 1.8 中引入了更严格的池 . 我正在尝试在测试用例下运行:
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
class DAGTest(unittest.TestCase):
def make_tasks(self):
dag = DAG('test_dag', description='a test',
schedule_interval='@once',
start_date=datetime(2018, 6, 26),
catchup=False)
du1 = DummyOperator(task_id='dummy1', dag=dag)
du2 = DummyOperator(task_id='dummy2', dag=dag)
du3 = DummyOperator(task_id='dummy3', dag=dag)
du1 >> du2 >> du3
dag.run()
def test_execute(self):
self.make_tasks()
例外:
Dependencies not met for <TaskInstance: test_dag.dummy3 2018-06-26 00:00:00 [upstream_failed]>, dependency 'Trigger Rule' FAILED: Task's trigger rule 'all_success' requires all
upstream tasks to have succeeded, but found 1 non-success(es).
upstream_tasks_state={'skipped': 0L, 'successes': 0L, 'failed': 0L,'upstream_failed': 1L, 'done': 1L, 'total': 1}, upstream_task_ids=['dummy2']
我做错了什么? 我已经尝试过 LocalExecutor 和 SequentialExecutor
环境:
Python 2.7
Airflow 1.9
我相信它正在尝试同时执行所有任务而不尊重依赖关系。 注意:类似代码用于 Airflow 1.7
【问题讨论】:
-
您没有包含足够的实际错误消息:
airflow.exceptions.AirflowException: dag_id could not be found: test_dag. Either the dag did not exist or it failed to parse. -
我首先在堆栈跟踪中看到上述异常,然后 dag_id 未找到异常。所以不确定是哪一个导致了这个问题。
标签: airflow