kaxil commented on a change in pull request #9851:
URL: https://github.com/apache/airflow/pull/9851#discussion_r456393849
##########
File path: airflow/models/serialized_dag.py
##########
@@ -212,3 +228,18 @@ def bulk_sync_to_db(dags: List[DAG], session=None):
min_update_interval=MIN_SERIALIZED_DAG_UPDATE_INTERVAL,
session=session
)
+
+ @classmethod
+ @provide_session
+ def get_last_updated_date(cls, dag_id: str, session: Session = None) ->
datetime:
+ """
+ Get the date when the Serialized DAG associated to DAG was last updated
+ in serialized_dag table
+
+ :param dag_id: DAG ID
+ :type dag_id: str
+ :param session: ORM Session
+ :type session: Session
+ """
+ result = session.query(cls.last_updated).filter(cls.dag_id ==
dag_id).one()
+ return result.last_updated
Review comment:
Updated in
https://github.com/apache/airflow/pull/9851/commits/02856d63a5d500788c8aab7c49a235b036800364
##########
File path: airflow/models/dagbag.py
##########
@@ -151,10 +151,10 @@ def get_dag(self, dag_id):
# Load from DB if not (yet) in the bag
self._add_dag_from_db(dag_id=dag_id)
- min_serialized_dag_update_secs =
timedelta(seconds=settings.MIN_SERIALIZED_DAG_UPDATE_INTERVAL)
+ min_serialized_dag_fetch_secs =
timedelta(seconds=settings.MIN_SERIALIZED_DAG_FETCH_INTERVAL)
if (
dag_id in self.dags_last_changed and
- timezone.utcnow() > self.dags_last_changed[dag_id] +
min_serialized_dag_update_secs
Review comment:
Updated in
https://github.com/apache/airflow/pull/9851/commits/02856d63a5d500788c8aab7c49a235b036800364
##########
File path: docs/dag-serialization.rst
##########
@@ -58,11 +58,16 @@ Add the following settings in ``airflow.cfg``:
[core]
store_serialized_dags = True
min_serialized_dag_update_interval = 30
+ min_serialized_dag_fetch_interval = 10
+ store_dag_code = True
* ``store_serialized_dags``: This flag decides whether to serialise DAGs and
persist them in DB.
If set to True, Webserver reads from DB instead of parsing DAG files
* ``min_serialized_dag_update_interval``: This flag sets the minimum
interval (in seconds) after which
the serialized DAG in DB should be updated. This helps in reducing
database write rate.
+* ``min_serialized_dag_fetch_interval``: This flag sets the minimum interval
(in seconds) after which
+ the serialized DAG will be fetched from DB from the Webserver. This helps
in reducing database read rate.
+ This config controls when your DAGs are updated in the Webserver.
Review comment:
Updated in
https://github.com/apache/airflow/pull/9851/commits/02856d63a5d500788c8aab7c49a235b036800364
----------------------------------------------------------------
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]