dstandish commented on code in PR #37851:
URL: https://github.com/apache/airflow/pull/37851#discussion_r1510093507


##########
airflow/serialization/pydantic/taskinstance.py:
##########
@@ -106,14 +107,59 @@ class TaskInstancePydantic(BaseModelPydantic, 
LoggingMixin):
     trigger_timeout: Optional[datetime]
     next_method: Optional[str]
     next_kwargs: Optional[dict]
-    run_as_user: Optional[str]
-    task: PydanticOperator
+    run_as_user: Optional[str] = None
+    task: Optional[PydanticOperator] = None
     test_mode: bool
     dag_run: Optional[DagRunPydantic]
     dag_model: Optional[DagModelPydantic]
-
+    raw: Optional[bool] = None
+    is_trigger_log_context: Optional[bool] = False
     model_config = ConfigDict(from_attributes=True, 
arbitrary_types_allowed=True)
 
+    @property
+    def _logger_name(self):
+        return "airflow.task"
+
+    def _run_raw_task(
+        self,
+        mark_success: bool = False,
+        test_mode: bool = False,
+        job_id: str | None = None,
+        pool: str | None = None,
+        raise_on_defer: bool = False,
+        session: Session = NEW_SESSION,
+    ):
+        self.refresh_from_db()
+        state = None
+        try:
+            context = self.get_template_context(ignore_param_exceptions=False)
+            TaskInstance._execute_task_with_callbacks(self, context, 
test_mode, session=session)
+            state = "success"
+            self.set_state(ti=self, state=state)
+        except Exception as e:
+            state = "failed"
+            self.set_state(ti=self, state=state)
+            raise

Review Comment:
   this is simplified version of the equivalent TI method



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