dabla commented on code in PR #55068:
URL: https://github.com/apache/airflow/pull/55068#discussion_r3000953411


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -986,9 +1037,19 @@ async def init_comms(self):
             raise RuntimeError(f"Required first message to be a 
messages.StartTriggerer, it was {msg}")
 
     async def create_triggers(self):
+        def create_runtime_ti(encoded_dag: dict) -> RuntimeTaskInstance:
+            task = 
DagSerialization.from_dict(encoded_dag).get_task(workload.ti.task_id)
+
+            # I need to recreate a TaskInstance from task_runner before 
invoking get_template_context (airflow.executors.workloads.TaskInstance)
+            return RuntimeTaskInstance.model_construct(

Review Comment:
   I went through the Airflow code base and in all cases (I think unless I 
missed one), all where constructed this way.
   
   Anyway the _ti_context_from_server  will now also be initialised, I also 
extracted the inner create_ti_method as you suggested and is now part of 
TriggerRunner class and we explictely pass the task_instance as parameter.
   
   All remarks from bellow will be addressed in this 
[PR](https://github.com/apache/airflow/pull/64298).



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

Reply via email to