benitezfede commented on code in PR #53654:
URL: https://github.com/apache/airflow/pull/53654#discussion_r2226856320
##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -2013,6 +2017,29 @@ def _get_log_template(log_template_id: int | None,
session: Session = NEW_SESSIO
def _get_partial_task_ids(dag: DAG | None) -> list[str] | None:
return dag.task_ids if dag and dag.partial else None
+ def serialize_for_callback(self) -> dict[str, Any]:
+ """
+ Serialize DagRun object into a dictionary for callback requests.
+
+ This method creates a serialized representation of the DagRun that can
be
+ safely passed to subprocesses without requiring database access.
+
+ :return: Dictionary containing serialized DagRun information
+ """
+ return {
+ "dag_id": self.dag_id,
+ "run_id": self.run_id,
+ "state": self.state,
+ "logical_date": self.logical_date.isoformat() if self.logical_date
else None,
+ "start_date": self.start_date.isoformat() if self.start_date else
None,
+ "end_date": self.end_date.isoformat() if self.end_date else None,
+ "conf": self.conf,
+ "run_type": self.run_type,
+ "run_after": self.run_after.isoformat() if self.run_after else
None,
+ "data_interval_start": self.data_interval_start.isoformat() if
self.data_interval_start else None,
+ "data_interval_end": self.data_interval_end.isoformat() if
self.data_interval_end else None,
+ }
+
Review Comment:
Thanks for addressing this issue!
--
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]