You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "potiuk (via GitHub)" <gi...@apache.org> on 2025/02/17 12:12:32 UTC
[PR] Speed-up check-default-configuration pre-commit [airflow]
potiuk opened a new pull request, #46821:
URL: https://github.com/apache/airflow/pull/46821
The check-default-configuration pre-commit added in #46622 is slow and it's not necessary to be run always - only when configuration definition changes. Also it does not really take any files from changed PR as input, so it should be configured to not pass the files to it and to not run parallel instances - because when run with `--all-files` it will run as many parallel copies of it as many processors you have and they will essentially run the same check.
Also this pre-commit requires breeze image to be present so it should be addded at the end of pre-commit files, so that is not run when breeze image is not built.
All this behaviours have been fixed in this PR. After this change:
* only one copy of the check is run when this pre-commit runs
* in local pre-commit will only be run if config.yml changes
* in canary runs it will always run (with --all-files)
* it is marked as "breeze image" tests by placing it at the end of pre-commit configuration file
<!--
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.
-->
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of an existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
<!-- Please keep an empty line above the dashes. -->
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
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](https://github.com/apache/airflow/tree/main/newsfragments).
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2662973138
cc: @jason810496 --> You likely did not know that :) but:
* pre-commit by default runs checks in parallel when you run it on group of files - it will split them in chunks and run as many processes as you have processors (this can be disabled by require_serial)
* also by default pre-commit will pass the list of files to pre-commit - those files that were locally changed in the PR and match the "files" specification if it is there. We **really** don't want to run this slow check on every PR - - so setting `files: ^airfflow/config_templates/config.yml` will only run the tests locally when the config.yml changes
* in all PRs we run `--all-files` in CI just to make sure we have no false positives introduced by some of the non-modified files
* in some PRs that are very small (for example README update) we do not build CI image at all, because we do not need it there, in those PR we automatically skip all pre-commits that are at the end of .pre-commit,yml file after certain comment (we parse it and extract list of "CI image" bound pre-commits). So if we want to add pre-commit that uses ci-image, it should be added at the end
Pre-commit relevant docs: https://pre-commit.com/#creating-new-hooks
Our contributing guide docs explaining all that: https://github.com/apache/airflow/blob/main/contributing-docs/08_static_code_checks.rst
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "jason810496 (via GitHub)" <gi...@apache.org>.
jason810496 commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2663071909
Thanks, @potiuk, for the explanation! Indeed, I'm not very familiar with `pre-commit` and overlooked these details. I'll take a closer look at the `pre-commit` documentation and the current configuration file.
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2663093607
Yeah. We have *VERY* complex and *VERY* comprehensive test harness and it has a few "you need to read a few pages few time and get burned once or twice to start to understand how things work"
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2662943426
cc @jason810496 also @Lee-W @jedcunningham -> we should be careful with adding new pre-commits. This small addition in pre-commit-config had almost all performance problems I could think of with pre-commits :D
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #46821:
URL: https://github.com/apache/airflow/pull/46821
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "Lee-W (via GitHub)" <gi...@apache.org>.
Lee-W commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2663107346
@potiuk Thanks for reminding us! Yep, I should have thought it through. 🤦♂️
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Speed-up check-default-configuration pre-commit [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #46821:
URL: https://github.com/apache/airflow/pull/46821#issuecomment-2663789743
> @potiuk Thanks for reminding us! Yep, I should have thought it through. 🤦♂️
I realise that only a handful of people including me leave and breathe the CI and dev env of Airflow, so I will keep on reminding and explaining - no worries :)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org