airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [airflow] potiuk opened a new pull request #6596: [AIRFLOW-6004] Untangle Executors class to avoid cyclic imports
Date Sun, 17 Nov 2019 18:40:30 GMT
potiuk opened a new pull request #6596: [AIRFLOW-6004] Untangle Executors class to avoid cyclic
   There are cyclic imports detected seemingly randomly by pylint checks when some
   of the PRs are run in CI:
   ************* Module airflow.utils.log.json_formatter
   airflow/utils/log/ R0401: Cyclic import
   (airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.pod_generator) (cyclic-import)
   airflow/utils/log/ R0401: Cyclic import (airflow ->
   airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.pod_launcher) (cyclic-import)
   airflow/utils/log/ R0401: Cyclic import
   (airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.worker_configuration -> airflow.kubernetes.pod_generator)
   The problem is that airflow's _init_ contains a few convenience imports
   (AirflowException, Executors etc.) but it also imports a number of packages
   (for example kubernetes_executor) that in turn import the airflow package
   objects - for example airflow.Executor. This leads to cyclic imports if you
   import first the executors before airflow. Similar problem happens with containing class "Executors" imported by all executors but
   at the same time some of the executors (for example KubernetesExecutor) import
   the very same Executor class.   
   This might happen in pylint checks in pre-commit because they split a number of
   files they process between the multiple threads you have at your machine and
   sometimes it might happen that the files are imported in different order.   
   As a solution, the executors "list" should be moved to a separate module.
   Also the name of constants was changed to not to be confused with class
   names and Executors class was renamed to AvailableExecutors.
   Make sure you have checked _all_ steps below.
   ### Jira
   - [x] My PR addresses the following [Airflow Jira](
issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
   ### Description
   - [x] Here are some details about my PR, including screenshots of any UI changes:
   ### Tests
   - [x] My PR adds the following unit tests __OR__ does not need testing for this extremely
good reason:
   ### Commits
   - [x] My commits all reference Jira issues in their subject lines, and I have squashed
multiple commits if they address the same issue. In addition, my commits follow the guidelines
from "[How to write a good git commit message](":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   ### Documentation
   - [x] In case of new functionality, my PR adds documentation that describes how to use
     - All the public functions and the classes in the PR contain docstrings that explain
what it does
     - If you implement backwards incompatible changes, please leave a note in the [](
so we can assign it to a appropriate release

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.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message