You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Prab-27 (via GitHub)" <gi...@apache.org> on 2025/09/01 09:20:20 UTC
Re: [PR] Remove Legacy Query Object Usage from airflow-models [airflow]
Prab-27 commented on code in PR #52325:
URL: https://github.com/apache/airflow/pull/52325#discussion_r2313387670
##########
providers/cncf/kubernetes/tests/unit/cncf/kubernetes/operators/test_pod.py:
##########
@@ -112,7 +112,28 @@ def create_context(task, persist_to_db=False, map_index=None):
dag = DAG(dag_id="dag", schedule=None, start_date=pendulum.now())
dag.add_task(task)
now = timezone.utcnow()
- if AIRFLOW_V_3_0_PLUS:
+ if AIRFLOW_V_3_1_PLUS:
+ with create_session() as session:
+ from airflow.models.dagbundle import DagBundleModel
+
+ bundle_name = "testing"
+ session.add(DagBundleModel(name=bundle_name))
+ session.flush()
+ session.add(DagModel(dag_id=dag.dag_id, bundle_name=bundle_name))
+ session.commit()
+ dag.sync_to_db()
+ SerializedDagModel.write_dag(dag, bundle_name="testing")
+ dag_run = DagRun(
+ run_id=DagRun.generate_run_id(
+ run_type=DagRunType.MANUAL, logical_date=DEFAULT_DATE, run_after=DEFAULT_DATE
+ ),
+ run_type=DagRunType.MANUAL,
+ dag_id=dag.dag_id,
+ logical_date=now,
+ data_interval=(now, now),
+ run_after=now,
+ )
Review Comment:
You're right, I checked and the lines are identical—removing them now. Sorry for the confusion!
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org