Граф коммитов

61 Коммитов

Автор SHA1 Сообщение Дата
Jarek Potiuk 680f767592
[AIRFLOW-7002] Get rid of yaml "parser" in bash (#7646)
Mounts in docker compose file is now generated from an env variable
2020-03-07 18:12:28 +01:00
Ash Berlin-Taylor c16181308b
[AIRFLOW-6382] Add reason for pre-commit rule (#7538) 2020-02-26 09:00:29 +00:00
Jarek Potiuk ccb2899e5b
[AIRFLOW-6663] Prepare backporting packages (#7391) 2020-02-24 10:29:38 +01:00
Jarek Potiuk 30898123ad
[AIRFLOW-6839] even more mypy speed improvements (#7460)
Require_serial:true is better choice than pass_filename: false as it can
speed-up mypy for single file changes.

Significant gains can be achieved for single file changes and no cache for all
other files. This is majority of cases for our users who have pre-commits
installed as hooks because most people change only few files and never run
check with --all-files

When just one file is changed and no cache is built, the difference is drastic:

require_serial: true = 4s

pass_filenames: false =  13s
2020-02-19 21:20:59 +01:00
Jarek Potiuk ff7034f39a
[AIRFLOW-6816] Simplified common functions in breeze scripts (#7430) 2020-02-16 20:05:50 +01:00
Ash Berlin-Taylor cc6e46f98d
[AIRFLOW-XXXX] Speed up mypy runs. (#7421)
This PR does two things:

1. It enables the mypy cache (default folder name .mypy_cache) so that
   repeated runs locally are quicker
2. It _disables_ passing only the changed files in.

Point 2 seems counter-intuitave, but in my testing running with all
files (airflow docs tests) was about twice as fast as without. My
hypothesis for why this happens is that when mypy is checking file x, it
has to check dependencies/imports for it too, and when we have
pass_filenames set runs multiple processes in parallel, and each of them
have to do this work!

Timings before and after:

- Before:

  For all files
  ```
  ❯ time pre-commit run mypy -a
  Run mypy.................................................................Passed
  pre-commit run mypy -a  0.31s user 0.07s system 2% cpu 17.140 total
  ```

  With only a single file

  ```
  ❯ time pre-commit run mypy --files airflow/configuration.py
  Run mypy.................................................................Passed
  pre-commit run mypy --files airflow/configuration.py  0.30s user 0.07s system 5% cpu 6.724 total
  ```

- After:

  With a clean cache (`rm -rf .mypy_cache`):

  ```
  $ time pre-commit run mypy
  Run mypy.................................................................Passed
  pre-commit run mypy -a  0.26s user 0.10s system 2% cpu 17.226 total
  ```

  Clean cache with single file:

  ```
  $ time pre-commit run mypy  --file airflow/version.py
  Run mypy.................................................................Passed
  pre-commit run mypy --file airflow/version.py  0.23s user 0.07s system 4% cpu 7.091 total
  ```

  Repeated run (cache folder exists):

  ```
  $ time pre-commit run mypy  --file airflow/version.py
  Run mypy.................................................................Passed
  pre-commit run mypy --file airflow/version.py  0.23s user 0.05s system 6% cpu 4.178 total
  ```

  and for all files

  ```
  airflow ❯ time pre-commit run mypy  -a
  Run mypy.................................................................Passed
  pre-commit run mypy -a  0.25s user 0.09s system 6% cpu 4.833 total
  ```
2020-02-15 14:30:31 +00:00
Felix Uellendall 94fccca970
[AIRFLOW-XXXX] Add pre-commit check for utf-8 file encoding (#7347)
Note: From Python 3.x onwards the explicit utf-8 header is no longer required. It is utf-8 encoded by default.
2020-02-04 09:44:35 +01:00
Kaxil Naik a311d3d82e
[AIRFLOW-6718] Fix more occurrences of utils.dates.days_ago (#7341) 2020-02-03 03:25:49 +05:30
Kamil Breguła cf141506a2
[AIRFLOW-6708] Set unique logger names (#7330) 2020-02-02 20:48:03 +01:00
Xinbin Huang 6b38b1bb8d
[AIRFLOW-6626] Add email on failure or retry to default config (#7249) 2020-02-02 14:44:14 +05:30
Jarek Potiuk 8325dd5507
[AIRFLOW-6635] Speed up static checks (#7256) 2020-01-25 15:06:27 +01:00
Jarek Potiuk e2524fac59
[AIRFLOW-6589] BAT tests run in pre-commit on bash script changes (#7203) 2020-01-19 13:15:43 +01:00
Kamil Breguła 934a2afcda [AIRFLOW-6537] Fix backticks in rst files (#7140) 2020-01-11 19:54:42 +01:00
Kaxil Naik a6676c4711
[AIRFLOW-XXXX] Move airflow-config-yaml pre-commit before pylint (#7108) 2020-01-08 21:48:22 +00:00
Jarek Potiuk a76df6e191
[AIRFLOW-6491] Improve handling of Breeze parameters (#7084)
While working on improving the way we run Kubernetes tests, we found out that I
need to fix handling of parameters - we change Kubernetes version used via Kind
and the old versions are no longer valid, however it was not properly
removed/saved.

We use the opportunity to add automated tests for that feature.

(cherry picked from commit 38dea9132d1fa36f4fbe871e2ab037be5ad3fab2)
2020-01-07 20:38:24 +01:00
Jarek Potiuk 2b374721f8
[AIRFLOW-6489] Add BATS support for Bash unit testing (#7081)
We have far too much bash code around that is not automatically tested.

This is the first step to change it (simplifications and more tests are coming
soon).
2020-01-07 15:38:05 +01:00
Kaxil Naik 09c895ee72
[AIRFLOW-6436] Cleanup for Airflow configs doc generator code (#7036) 2020-01-04 16:18:19 +00:00
Kaxil Naik a94d82f114
[AIRFLOW-6436] Create & Automate docs on Airflow Configs (#7015) 2020-01-03 17:47:44 +00:00
Tomek Urbaszek de5b43a93c [AIRFLOW-6391] Move content of utils.tests to tests.test_utils (#6949) 2019-12-29 21:17:56 +01:00
Tomek Urbaszek d2cbf92290
[AIRFLOW-6382] Extract provide/create session to session module (#6938)
Extracting provide_session and create_session to separate module
reduces number of cyclic imports and make a disctinction between
session and database
2019-12-28 20:31:07 +01:00
Tomek Urbaszek 34292a5eeb [AIRFLOW-6383] Add no trailing-whitespace pre-commit hook (#6941) 2019-12-28 19:34:35 +01:00
Jarek Potiuk b355fd65ac
[AIRFLOW-6140] Add missing types for some core classes (#6702) 2019-12-04 21:35:07 +01:00
Jarek Potiuk a36cfe049a
[AIRFLOW-6004] Untangle Executors class to avoid cyclic imports (#6596)
There are cyclic imports detected seemingly randomly by pylint checks when some
    of the PRs are run in CI

    It was not deterministic because pylint usually uses as many processors as
    many are available and it splits the list of .py files between the separate
    pylint processors - depending on how the split is done, pylint check might
    or might not detect it. The cycle is always detected when all files are used.

    In order to make it more deterministic, all pylint and mypy errors were resolved
    in all executors package and in dag_processor.

    At the same time plugins_manager had also been moved out of the executors
    and all of the operators/hooks/sensors/macros because it was also causing
    cyclic dependencies and it's far easier to untangle those dependencies
    in executor when we move the intialisation of all plugins to plugins_manager.

    Additionally require_serial is set in pre-commit configuration to
    make sure cycle detection is deterministic.
2019-12-03 16:02:20 +01:00
Jarek Potiuk 2f2f89c148
[AIRFLOW-6139] Consistent spaces in pylint enable/disable (#6701) 2019-12-01 12:26:10 +01:00
Jarek Potiuk 04445205b2
[AIRFLOW-6138] Fixed escaping of pre-commit dots (#6700) 2019-12-01 11:14:52 +01:00
Jiajie Zhong fc2098f5df [AIRFLOW-6089] Reorder setup.py dependencies and add ci (#6681)
* Reorder dependencies in setup.py
2019-11-30 10:05:14 +01:00
Jarek Potiuk 03c870a617 [AIRFLOW-6010] Remove cyclic imports and pylint hacks (#6601) 2019-11-26 22:19:45 +00:00
Jarek Potiuk 0ff9e23070
[AIRFLOW-6066] Added pre-commit checks for accidental debug stmts (#6662) 2019-11-26 09:28:42 +01:00
Kamil Breguła 63fcc73ee1
[AIRFLOW-5915] Add support for the new documentation theme (#6563) 2019-11-25 22:11:26 +01:00
Jarek Potiuk b4c7538b86
[AIRFLOW-5830] Get rid of slim image (#6494)
The slim image gave only very small gain on executing the tests in CI. The
image was significantly smaller, but then for local development and testing
you needed both full CI and SLIM-CI image.

This made the scripts and docker image needlessly complex - especially
in the wake of coming Production image it turned to be premature
optimisation really. While it sped-up (slightly - by 10-20 seconds) some
static check jobs in Travis, it increased time needed by developers
to have a working environment and to keep it updated every time it was
needed (by minutes)

Also having two separately managed images made it rather complex to join
some of the Travis CI jobs (there is a follow-up change with getting rid
of Checklicence image).

With this change both static checks and tests are executed using single
image. That also opens doors for further simplification of the scripts
and easier implementation of production image.
2019-11-05 22:30:00 +01:00
Jarek Potiuk 45e108d3d9
[AIRFLOW-5827] Move build to later stage in pre-commit (#6493)
This change is to move build stage of pre-commit as late as possible in pre-commit
chain. This is useful if you do not want to rebuild the docker images needed
to run pylint/mypy/flake8 - and still see the result of other checks immediately
after you run commit.
2019-11-04 15:59:48 +01:00
Jarek Potiuk d2595de91d
[AIRFLOW-5826] Added auto-generation of breeze output in BREEZE.rst (#6490)
This is needed to keep breeze --help in sync with the documentation.

It makes it easier for the follow-up changes needed for production
image to keep the docs in sync with the code.
2019-11-04 10:37:31 +01:00
Jarek Potiuk bb0161655c
[AIRFLOW-5839] Upgrade pre-commit and hooks to latest versions (#6492)
We want to use latest pre-commit version as well as latest
version of the plugins used.
2019-11-04 09:50:06 +01:00
Jarek Potiuk a80707fdd2 [AIRFLOW-XXX] Updates to Breeze documentation from GSOD (#6285)
Co-authored-by: Elena Fedotova <lavel@mail.ru>
Co-authored-by: Felix Uellendall <feluelle@users.noreply.github.com>
2019-10-26 13:31:51 +02:00
Jarek Potiuk ba01ed538f
[AIRFLOW-5750] Licence check is done also for non-executable .sh (#6425) 2019-10-25 09:54:36 +02:00
Gerardo Curiel e62056b225 [AIRFLOW-5223] Use kind for Kubernetes in CI (#5837)
This PR reimplements Kubernetes integration testing using kind,
a tool for running local Kubernetes clusters using Docker container
"nodes". The "nodes" are deployed to a separate docker daemon
(dind) started through docker-compose.
2019-10-15 12:56:09 +02:00
Kamil Breguła 76fe45e1d1 [AIRFLOW-5604] Remove duplicated isort check (#6272) 2019-10-06 18:10:47 +02:00
Kevin Yang d719e1fd67 [AIRFLOW-5362] Reorder imports (#5944) 2019-10-02 16:30:03 +01:00
Kaxil Naik ccf44086c5 [AIRFLOW-5531] Replace deprecated log.warn() with log.warning() (#6165)
- Add pre-commit hook to detect this
2019-09-22 08:55:39 +01:00
Kaxil Naik cfd8d605d9
[AIRFLOW-XXX] Fix backtick issues in .rst files & Add Precommit hook (#6162) 2019-09-21 20:47:02 +01:00
Jarek Potiuk 857788e305
[AIRFLOW-5369] Adds interactivity to pre-commits (#5976)
This commit adds full interactivity to pre-commits. Whenever you run pre-commit
and it detects that the image should be rebuild, an interactive question will
pop up instead of failing the build and asking to rebuild with REBUILD=yes

This is much nicer from the user perspective. You can choose whether to:
1) Rebuild the image (which will take some time)
2) Not rebuild the image (this will use the old image with hope it's OK)
3) Quit.

Answer to that question is carried across all images needed to rebuild.
There is the special "build" pre-commit hook that takes care about that.

Note that this interactive question cannot be asked if you run only
single pre-commit hook with Dockerfile because it can run multiple processes
and you can start building in parallel. This is not desired so instead we fail
such builds.
2019-09-18 13:43:30 +02:00
Jarek Potiuk 4780105798 [AIRFLOW-5256] Related pylint changes for common licences in python files (#5786) 2019-09-17 13:16:32 +02:00
Jarek Potiuk 455eb41ba6
[AIRFLOW-5437] Better python version detection/explanation. (#6060)
We have fairly complex python version detection in our CI scripts.

They have to handle several cases:

1) Running builds on DockerHub (we cannot pass different environment
   variables there, so we detect python version based on the image
   name being build (airflow:master-python3.7 -> PYTHON_VERSION=3.7)

2) Running builds on Travis CI. We use python version determined
   from default python3 version available on the path. This way we
   do not have to specify PYTHON_VERSION separately in each job,
   we just specify which host python version is used for that job.
   This makes a nice UI experience where you see python version in
   Travis UI.

3) Running builds locally via scripts where we can pass PYTHON_VERSION
   as environment variable.

4) Running builds locally for the first time with Breeze. By default
   we determine the version based on default python3 version we have
   in the host system (3.5, 3.6 or 3.7) and we use this one.

5) Selecting python version with Breeze's --python switch. This will
   override python version but it will also store the last used version
   of python in .build directory so that it is automatically used next
   time.

This change adds necessary explanations to the code that works for
all the cases and fixes some of the edge-cases we had. It also
extracts the code to common directory.
2019-09-10 10:16:10 +02:00
Jarek Potiuk 51d2e1bbb2 [AIRFLOW-5404] Switch back to using Lucas-C pre-commit-hooks
The fuzzy licence matching implemented by Jarek Potiuk
was accepted and merged by Lucas-C in his pre-commit
hooks implementation (released today ver. 1.1.7)
so we can switch back to it.
2019-09-05 01:12:12 +02:00
Jarek Potiuk a8dc50db4b [AIRFLOW-5371] Remove yamllint as prerequisite to run pre-commit 2019-09-02 11:37:32 -04:00
Jarek Potiuk 4d7bf965cc [AIRFLOW-5372] Apache license check runs locally on LICENCE changes
Licence check for RAT runs too often (every time pre-commit is modified) and it
should only be run (locally) when any of *LICEN[S|C]E* files change. We anyhow
run full check on CI so this is local optimisation (it runs too long while you
play with .pre-commit-config.yaml - and we will probably be able to detect some
problems locally as well when new modules are added.
2019-09-02 11:08:48 -04:00
Jarek Potiuk eafd17d7d8 [AIRFLOW-5326] Fixed regression of Apache check running always 2019-08-28 04:14:55 -04:00
Jarek Potiuk 286aa7a581
[AIRFLOW-3611] Simplified development environment (#4932) 2019-08-27 14:39:36 -04:00
Jarek Potiuk afa7180c16
[AIRFLOW-5226] Consistent licences for all jinja templates (#5828) 2019-08-27 14:06:41 -04:00
Jarek Potiuk 308c07b3f6
[AIRFLOW-5316] Skip running check-apache-license without --all-files (#5917) 2019-08-27 14:03:27 -04:00