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


##########
airflow-core/src/airflow/jobs/triggerer_job_runner.py:
##########
@@ -627,6 +631,51 @@ def emit_metrics(self):
             }
         )
 
+    @provide_session
+    def create_workload(
+        self,
+        trigger: Trigger,
+        dag_bag: DBDagBag,
+        render_log_fname=log_filename_template_renderer(),
+        session: Session = NEW_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

Review Comment:
   No idea this code is/was already like this in the main codebase.



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