amoghrajesh commented on code in PR #67299: URL: https://github.com/apache/airflow/pull/67299#discussion_r3339652988
########## airflow-core/docs/administration-and-deployment/state-cleanup.rst: ########## @@ -0,0 +1,109 @@ + .. Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + .. http://www.apache.org/licenses/LICENSE-2.0 + + .. Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + +.. _state-cleanup: + +State Cleanup +============= + +.. versionadded:: 3.3 + +Airflow does not automatically purge task state rows on a schedule. Cleanup (also known as "garbage collection") is the responsibility of the user (you) and must be triggered explicitly via the CLI. This page explains what gets cleaned up, how to run it, and how to integrate it into a recurring maintenance workflow. + + +What gets cleaned up +-------------------- + +The cleanup command operates only on **task state** rows in the ``MetastoreStateBackend``. Asset state rows are never touched by this command. Asset state rows are removed only by the orphan sweep when an asset is deactivated (see :ref:`state-store`). + +A task state row is eligible for deletion when its ``expires_at`` timestamp is in the past. ``expires_at`` is computed on the worker at write time: + +* Keys written with an explicit ``retention=timedelta(...)`` expire after that duration from the time of the write. +* Keys written with ``retention=None`` (the default) pick up an expiry based on ``[state_store] default_retention_days``. If that value is ``> 0``, the key expires that many days after the write. Review Comment: It wasn't checked, fix here: https://github.com/apache/airflow/pull/67890 -- 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]
