You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/05/16 17:34:19 UTC
[GitHub] [airflow] Bowrna commented on a diff in pull request #23731: committing to start discussion
Bowrna commented on code in PR #23731:
URL: https://github.com/apache/airflow/pull/23731#discussion_r873989382
##########
tests/jobs/test_scheduler_job.py:
##########
@@ -4120,22 +4120,40 @@ def test_task_with_upstream_skip_process_task_instances():
dr = dag.create_dagrun(run_type=DagRunType.MANUAL, state=State.RUNNING, execution_date=DEFAULT_DATE)
assert dr is not None
+ # def get_ti_from_db(task):
+ # return (
+ # session.query(TaskInstance)
+ # .filter(
+ # TaskInstance.dag_id == dag.dag_id,
+ # TaskInstance.task_id == task.task_id,
+ # TaskInstance.run_id == dr.run_id,
+ # )
+ # .one()
+ # )
+
+ # with create_session() as session:
+ # get_ti_from_db(dummy1).state = State.SKIPPED
+ # get_ti_from_db(dummy2).state = State.SUCCESS
+ # session.flush()
+
with create_session() as session:
tis = {ti.task_id: ti for ti in dr.get_task_instances(session=session)}
# Set dummy1 to skipped and dummy2 to success. dummy3 remains as none.
tis[dummy1.task_id].state = State.SKIPPED
tis[dummy2.task_id].state = State.SUCCESS
assert tis[dummy3.task_id].state == State.NONE
+ session.commit()
+ # dr.refresh_from_db(session=session)
# dag_runs = DagRun.find(dag_id='test_task_with_upstream_skip_dag')
Review Comment:
@potiuk
I tried to get rid of xfail test in `tests/jobs/test_scheduler_job.py::test_task_with_upstream_skip_process_task_instances` but in this function the comment says it expects dummy3 to be skipped. But it is returned as None. Can you tell me the expected behaviour?
I tried to check similar place in code where they try to skip task and find out the state of downstream task but I couldn't find many.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org