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/12/02 11:47:20 UTC

[GitHub] [airflow] atrbgithub opened a new pull request, #28066: Return list of tasks that will be queued

atrbgithub opened a new pull request, #28066:
URL: https://github.com/apache/airflow/pull/28066

   Ensure that when a user clicks on 'Queue up new tasks', the list of tasks that will be run is returned rather than a blank list. 
   
   closes: https://github.com/apache/airflow/issues/28065


-- 
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


[GitHub] [airflow] bbovenzi merged pull request #28066: Return list of tasks that will be queued

Posted by GitBox <gi...@apache.org>.
bbovenzi merged PR #28066:
URL: https://github.com/apache/airflow/pull/28066


-- 
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


[GitHub] [airflow] bbovenzi commented on a diff in pull request #28066: Return list of tasks that will be queued

Posted by GitBox <gi...@apache.org>.
bbovenzi commented on code in PR #28066:
URL: https://github.com/apache/airflow/pull/28066#discussion_r1038509576


##########
airflow/www/views.py:
##########
@@ -2298,13 +2299,24 @@ def _mark_dagrun_state_as_queued(self, dag_id: str, dag_run_id: str, confirmed:
         if not dag:
             return {"status": "error", "message": f"Cannot find DAG: {dag_id}"}
 
-        new_dag_state = set_dag_run_state_to_queued(dag=dag, run_id=dag_run_id, commit=confirmed)
+        set_dag_run_state_to_queued(dag=dag, run_id=dag_run_id, commit=confirmed)
 
         if confirmed:
             return {"status": "success", "message": "Marked the DagRun as queued."}
 
         else:
-            details = [str(t) for t in new_dag_state]
+            # Identify tasks that will be queued up to run when confirmed
+            all_task_ids = [task.task_id for task in dag.tasks]
+
+            existing_tis = session.query(TaskInstance.task_id).filter(
+                TaskInstance.dag_id == dag.dag_id,
+                TaskInstance.run_id == dag_run_id,
+                TaskInstance.state is not None,

Review Comment:
   Do we need to check for `state is not None`? Aren't we looking for tasks that don't have a corresponding instance for this run?



-- 
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


[GitHub] [airflow] atrbgithub commented on a diff in pull request #28066: Return list of tasks that will be queued

Posted by GitBox <gi...@apache.org>.
atrbgithub commented on code in PR #28066:
URL: https://github.com/apache/airflow/pull/28066#discussion_r1039283854


##########
airflow/www/views.py:
##########
@@ -2298,13 +2299,24 @@ def _mark_dagrun_state_as_queued(self, dag_id: str, dag_run_id: str, confirmed:
         if not dag:
             return {"status": "error", "message": f"Cannot find DAG: {dag_id}"}
 
-        new_dag_state = set_dag_run_state_to_queued(dag=dag, run_id=dag_run_id, commit=confirmed)
+        set_dag_run_state_to_queued(dag=dag, run_id=dag_run_id, commit=confirmed)
 
         if confirmed:
             return {"status": "success", "message": "Marked the DagRun as queued."}
 
         else:
-            details = [str(t) for t in new_dag_state]
+            # Identify tasks that will be queued up to run when confirmed
+            all_task_ids = [task.task_id for task in dag.tasks]
+
+            existing_tis = session.query(TaskInstance.task_id).filter(
+                TaskInstance.dag_id == dag.dag_id,
+                TaskInstance.run_id == dag_run_id,
+                TaskInstance.state is not None,

Review Comment:
   @bbovenzi I've removed this check. When testing. I had thought I'd seen it get into a state where a task would end up in the database but the state was None. I can't reproduce this so have removed it. 



-- 
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