uranusjr commented on a change in pull request #18724:
URL: https://github.com/apache/airflow/pull/18724#discussion_r754992077
##########
File path: airflow/api/common/experimental/mark_tasks.py
##########
@@ -104,6 +120,16 @@ def set_state(
if dag is None:
raise ValueError("Received tasks with no DAG")
+ if run_id is not None:
+ dr = (
+ session.query(DagRun.execution_date)
+ .filter(DagRun.run_id == run_id, DagRun.dag_id == dag.dag_id)
+ .one_or_none()
+ )
+ if dr is None:
+ raise ValueError(f"Run id {run_id} not found")
+ execution_date = dr.execution_date
+
dates = get_execution_dates(dag, execution_date, future, past)
Review comment:
Instead of getting a list of dates and then look up task instances from
them (`get_all_dag_task_query`), we should instead get a list of `run_id`s and
looks up task instances of those instead. This entire function should be
entirely reconstructed to operate around DAG runs instead of dates, and all of
`get_execution_dates`, `verify_dag_run_integrity`, `get_subdag_runs`, and
`get_all_dag_task_query` should either be deprecated or removed/rewritten
entirely.
--
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]