New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added a new condition before launching the self._scan_stale_dags() fu… #39159
base: main
Are you sure you want to change the base?
Conversation
…nction this condition will allow us to have the choice of purging expired dags or keeping them
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
In order for that change would be considered for merging - it needs to have more explanation, documentation, configuration parameter added and described in the templates and unit tests. |
add doc for disable deletion of stale dags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also could you add test cases for that one into the https://github.com/apache/airflow/blob/main/tests/dag_processing/test_processor.py
Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is>
Co-authored-by: Andrey Anshin <Andrey.Anshin@taragol.is>
Ok and thanks for the two suggestions :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work on your first PR. Have some comments, and also unit tests are needed
airflow/config_templates/config.yml
Outdated
@@ -500,6 +500,13 @@ core: | |||
type: integer | |||
example: ~ | |||
default: "4096" | |||
disalble_scan_stale_dags: | |||
description: | | |||
Stale dags are deleted by default, [core] disalble_scan_stale_dags is True if you want to keep them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct this in context of above comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -59,6 +59,8 @@ unit_test_mode = True | |||
killed_task_cleanup_time = 5 | |||
# We only allow our own classes to be deserialized in tests | |||
allowed_deserialization_classes = airflow.* tests.* | |||
# expired dags are deleted by default, you can put true in this variable if you want to keep them. | |||
disalble_scan_stale_dags = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
In a versioned DAG context, there may be a need to run two versions of DAGs in parallel in two versions of workers. | ||
It can also be useful to keep the allowed DAGs if they are still in progress in the worker (n -1). | ||
To keep the allowed DAGs, you can change the value of the variable ``AIRFLOW__CORE__DISABLE_SCAN_STALE_DAGS`` to ``True``. By default, it is set to ``False``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that we can also set in config.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
There are a couple of exceptions, but I think the configs are generally positive, i.e. this should use |
Indeed, if it suits everyone we can go there :) |
Ok, it's in progress 👍 |
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
rename scan_stale_dags
add unitest for enable_purging_stale_dags condition
@@ -924,3 +924,10 @@ if it fails for ``N`` number of times consecutively. | |||
we can also provide and override these configuration from DAG argument: | |||
|
|||
- ``max_consecutive_failed_dag_runs``: Overrides :ref:`config:core__max_consecutive_failed_dag_runs_per_dag`. | |||
|
|||
Disable deletion of stale DAGs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May want to clarify this. DAGs are always “deleted” (from the DAG file) to become stale, so we should try to explain here about the concept of DAGs being stale, and what keeping stale DAGs actually means.
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
fix doc and variables
…nction
this condition will allow us to have the choice of purging expired dags or keeping them
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.