Adding configuration to control retry parameters for k8s api client - #29809
Conversation
hussein-awala
left a comment
There was a problem hiding this comment.
Could you run the pre-commit to fix the static checks (How to prepare a PR), and check why the tests failed?
|
@hussein-awala I fixed all the unit tests but I think the staticchecks is still failing and I cannot reason why it is happening. |
hussein-awala
left a comment
There was a problem hiding this comment.
you need to add some tests for the provided configs, here is an example to how to mock Airflow config.
|
Tests need fixing. |
|
Or at least it used to write the instructions- I need to see why it did not do it before. But the detailed instructions are here https://github.com/apache/airflow/blob/main/CI.rst#replicating-the-ci-jobs-locally |
|
It seems like there is an issue in the mock lib (or unittest) installed in the CI image. I had the same problem with breeze, but when I installed I'll check it again, and open a separate PR to fix the issue. |
Interesting. We have no non-standard mock installed at all in Airlfow - https://github.com/apache/airflow/blob/constraints-main/constraints-3.7.txt - we are using standard mock that comes built-in in Python. Maybe there is a different behaviour of the python version you use @amoghrajesh and that's why you can't reproduce it ? Or some other mocking library is changing the mock behaviour. Note that in Breeze we are using (automatically - it gest upgraded behind the scenes right after it gets released and tests pass) the latest version of released Python in given Python line for example currently it is. For example for Python 3.7 it is. But maybe you are not using Python 3.7 at all (the tests in PR use the lowest supported Python version - which is 3.7 and maybe this is simply difference vs. 3.7 and 3.8 that you need to handle differently ? We still suport 3.7 till July: https://github.com/apache/airflow/blob/main/README.md#support-for-python-and-kubernetes-versions So maybe the way to reproduce it locally is build your Python venv from latest 3.7 and make sure you have no extra "mock" installed (if you have it installed in your environment @amoghrajesh ) and then you will be able to reproduce. If that's the case that you can reproduce it this way, then it's the classic "works for me" case and precisely what |
|
BTW. I can test the Python 3.7 hypothesis. I can add "full tests needed" to the PR and then it will run a matrix of tests with different Python versions and we will see if this is the reason. |
|
Closed/Reopened to rebuild with the "full tests needed" label |
|
Yep. This was a good hypothesis. Seems that this tests does not work for Python 3.7 only You should fix it so it also works there. Switching to Python 3.7 in your local venv should give you reproducible case. Classic "works for me" problem as I thought. |
…29809) * Adding configuration to control retry parameters for k8s api client * Handling review comments * Fixing code bug * Fixing failing tests * Temporary commit with UT wip * Fixing unit test * Fixing the strict checks * Handling review comments from Hussein * Revert "Handling review comments from Hussein" This reverts commit fa3bc26. * Fixing failing ut * Reverting bad hack * Updating logic in kube_client.py Co-authored-by: Hussein Awala <hussein@awala.fr> * Fixing unit tests * Fixing unit tests * Handling review comments from Ash * Fix loading mock call args for python3.7 * Apply suggestions from code review * fix static check * add in 2.6.0 --------- Co-authored-by: Amogh <adesai@cloudera.com> Co-authored-by: Hussein Awala <houssein.awala.96@gmail.com> (cherry picked from commit dcffbb4)
|
Thank you for assisting with the test case failure @hussein-awala |
…pache#29809) * Adding configuration to control retry parameters for k8s api client * Handling review comments * Fixing code bug * Fixing failing tests * Temporary commit with UT wip * Fixing unit test * Fixing the strict checks * Handling review comments from Hussein * Revert "Handling review comments from Hussein" This reverts commit fa3bc26. * Fixing failing ut * Reverting bad hack * Updating logic in kube_client.py Co-authored-by: Hussein Awala <hussein@awala.fr> * Fixing unit tests * Fixing unit tests * Handling review comments from Ash * Fix loading mock call args for python3.7 * Apply suggestions from code review * fix static check * add in 2.6.0 --------- Co-authored-by: Amogh <adesai@cloudera.com> Co-authored-by: Hussein Awala <houssein.awala.96@gmail.com>
K8s api server doesn't have the option to configure the retry parameters. PR adds support to add these parameters in the default config file as well as config.yml.
closes: #24748
^ 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.rstor{issue_number}.significant.rst, in newsfragments.