dstandish commented on code in PR #24743:
URL: https://github.com/apache/airflow/pull/24743#discussion_r916127261
##########
tests/models/test_dagrun.py:
##########
@@ -1291,6 +1309,38 @@ def consumer(*args):
assert dr.state == DagRunState.FAILED
+def test_dataset_dagruns_triggered(session):
+ from airflow.example_dags import example_datasets
+ from airflow.example_dags.example_datasets import dag1
+
+ session = settings.Session()
+ dagbag = DagBag(dag_folder=example_datasets.__file__)
+ dagbag.collect_dags(only_if_updated=False, safe_mode=False)
+ dagbag.sync_to_db(session=session)
+ run_id = str(uuid4())
+ dr = DagRun(dag1.dag_id, run_id=run_id, run_type='anything')
+ dr.dag = dag1
+ session.add(dr)
+ session.commit()
+ assert dr.id is not None
+ task = dag1.get_task('upstream_task_1')
+ task.bash_command = 'echo 1' # make it go faster
+ ti = TaskInstance(task, run_id=run_id)
+ session.merge(ti)
+ session.commit()
+ ti._run_raw_task()
+ ti.refresh_from_db()
+ assert ti.state == State.SUCCESS
+ assert session.query(DatasetDagRunQueue.target_dag_id).filter(
+ DatasetTaskRef.dag_id == dag1.dag_id, DatasetTaskRef.task_id ==
'upstream_task_1'
+ ).all() == [('dag3',), ('dag4',), ('dag5',)]
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]