jason810496 commented on code in PR #55068:
URL: https://github.com/apache/airflow/pull/55068#discussion_r2671481673
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -944,9 +975,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(
+ **workload.ti.model_dump(exclude_unset=True),
+ task=task,
+ )
Review Comment:
> not a good idea to add a to_runtime method in TaskInstance, as this
implies import sdk related classes in core, which is a design issue and will
once the split will be finished, won't probably even not be possible anymore.
Yes, agree with this point as well, but It seems the only way is still
importing sdk in core to achieve it as workaround right now, like
https://github.com/apache/airflow/pull/59922/files#diff-778c524452ed1369f25378f48387068fbfc2c2950eb9fd827c62952a4d48e6f3R229-R246
Or we have to move the rendering template things to shared lib.
--
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]