junyeong0619 commented on issue #61803: URL: https://github.com/apache/airflow/issues/61803#issuecomment-4397391209
Hi @amoghrajesh, I got interested in this issue and did some analysis. I'd like to propose a focused PR removing two airflow-core imports inside _run_task (task-sdk/src/airflow/sdk/definitions/dag.py): 1. airflow.utils.session.create_session (L1473) — sub-issue #54710 2. airflow.serialization.serialized_objects.create_scheduler_operator (L1484) Both are coupled: they exist only because _run_task does an ORM write (session.add(ti)) for the DEFERRED → SCHEDULED transition after inline trigger execution. Proposal: move the DB-write responsibility from _run_task up to its caller (dag.test), which already has a session in scope. _run_task returns state-transition intent via TaskRunResult; the caller performs the write. I'd keep the scope limited to _run_task and its single caller in dag.test. Does this direction look acceptable? -- 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]
