SamWheating commented on a change in pull request #14306:
URL: https://github.com/apache/airflow/pull/14306#discussion_r579822073
##########
File path: airflow/api_connexion/schemas/dag_schema.py
##########
@@ -82,6 +83,18 @@ class DAGDetailSchema(DAGSchema):
doc_md = fields.String(dump_only=True)
default_view = fields.String(dump_only=True)
params = fields.Dict(dump_only=True)
+ is_paused = fields.Method("get_is_paused", dump_only=True)
+ is_active = fields.Method("get_is_active", dump_only=True)
+
+ @staticmethod
+ def get_is_paused(obj: DAG):
+ """Checks entry in DAG table to see if this DAG is paused"""
+ return obj.get_is_paused()
+
+ @staticmethod
+ def get_is_active(obj: DAG):
+ """Checks entry in DAG table to see if this DAG is active"""
+ return obj.get_is_active()
Review comment:
This is in the DAG Detail Schema, which only gets called on an
individual DAG using `/dags/{dag_id}/details`
In the `/dags/` endpoint, a set of DAGModel objects are dumped to the DAG
schema. This object has `is_active` as a parameter and won't require n queries
for n DAGs.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]