ashb commented on a change in pull request #6792: [AIRFLOW-5930] Use cached-SQL query building for hot-path queries URL: https://github.com/apache/airflow/pull/6792#discussion_r367154648
########## File path: airflow/jobs/scheduler_job.py ########## @@ -1306,33 +1271,32 @@ def _enqueue_task_instances_with_queued_state(self, simple_dag_bag, :param simple_dag_bag: Should contains all of the task_instances' dags :type simple_dag_bag: airflow.utils.dag_processing.SimpleDagBag """ - TI = models.TaskInstance # actually enqueue them - for simple_task_instance in simple_task_instances: - simple_dag = simple_dag_bag.get_dag(simple_task_instance.dag_id) - command = TI.generate_command( - simple_task_instance.dag_id, - simple_task_instance.task_id, - simple_task_instance.execution_date, + for ti in task_instances: + simple_dag = simple_dag_bag.get_dag(ti.dag_id) + command = ti.generate_command( + ti.dag_id, + ti.task_id, + ti.execution_date, local=True, mark_success=False, ignore_all_deps=False, ignore_depends_on_past=False, ignore_task_deps=False, ignore_ti_state=False, - pool=simple_task_instance.pool, + pool=ti.pool, file_path=simple_dag.full_filepath, pickle_id=simple_dag.pickle_id) - priority = simple_task_instance.priority_weight - queue = simple_task_instance.queue + priority = ti.priority_weight + queue = ti.queue self.log.info( "Sending %s to executor with priority %s and queue %s", - simple_task_instance.key, priority, queue + ti.key, priority, queue ) self.executor.queue_command( Review comment: This is actually more complex than it seems -- calling queue_task_instance sends it via `ti.command_as_list`, but to get the same behaviour with filepath we'd need to have ti.task.dag be set, but the ti doesn't have a task set. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services