airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (Jira)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-6004) Untangle "Executors" class from potentially cyclic import
Date Sun, 17 Nov 2019 18:41:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-6004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16976123#comment-16976123
] 

ASF GitHub Bot commented on AIRFLOW-6004:
-----------------------------------------

potiuk commented on pull request #6596: [AIRFLOW-6004] Untangle Executors class to avoid cyclic
imports
URL: https://github.com/apache/airflow/pull/6596
 
 
   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/json_formatter.py:1:0: R0401: Cyclic import
   (airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.pod_generator) (cyclic-import)
   airflow/utils/log/json_formatter.py:1:0: R0401: Cyclic import (airflow ->
   airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.pod_launcher) (cyclic-import)
   airflow/utils/log/json_formatter.py:1:0: R0401: Cyclic import
   (airflow.executors -> airflow.executors.kubernetes_executor ->
   airflow.kubernetes.worker_configuration -> airflow.kubernetes.pod_generator)
   (cyclic-import)
   
   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
   executor._init_.py 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](https://issues.apache.org/jira/browse/AIRFLOW/)
issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
     - https://issues.apache.org/jira/browse/AIRFLOW-6004
   
   ### 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](http://chris.beams.io/posts/git-commit/)":
     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
it.
     - 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 [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md)
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:
users@infra.apache.org


> Untangle "Executors" class from potentially cyclic import
> ---------------------------------------------------------
>
>                 Key: AIRFLOW-6004
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-6004
>             Project: Apache Airflow
>          Issue Type: Sub-task
>          Components: ci
>    Affects Versions: 2.0.0
>            Reporter: Jarek Potiuk
>            Priority: Major
>
> See the description in https://issues.apache.org/jira/browse/AIRFLOW-6003



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message