dabla commented on code in PR #55068:
URL: https://github.com/apache/airflow/pull/55068#discussion_r3001203889
##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -658,6 +662,65 @@ def emit_metrics(self):
extra_tags={"hostname": self.job.hostname},
)
+ def _create_workload(
+ self,
+ trigger: Trigger,
+ dag_bag: DBDagBag,
+ render_log_fname: Callable[..., str],
+ session: Session,
+ ) -> workloads.RunTrigger | None:
+ if trigger.task_instance is None:
+ return workloads.RunTrigger(
+ id=trigger.id,
+ classpath=trigger.classpath,
+ encrypted_kwargs=trigger.encrypted_kwargs,
+ )
+
+ if not trigger.task_instance.dag_version_id:
+ # This is to handle 2 to 3 upgrade where TI.dag_version_id can be
none
+ log.warning(
+ "TaskInstance associated with Trigger has no associated Dag
Version, skipping the trigger",
+ ti_id=trigger.task_instance.id,
+ )
+ return None
+
+ log_path = render_log_fname(ti=trigger.task_instance)
+ ser_ti = TaskInstanceDTO.model_validate(trigger.task_instance,
from_attributes=True)
+
+ # When producing logs from TIs, include the job id producing the logs
to disambiguate it.
+ self.logger_cache[trigger.id] = TriggerLoggingFactory(
+ log_path=f"{log_path}.trigger.{self.job.id}.log",
+ ti=ser_ti, # type: ignore
+ )
+
+ serialized_dag_model = dag_bag.get_serialized_dag_model(
Review Comment:
That will be done in yet another PR.
--
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]