You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/01/18 23:36:58 UTC

[GitHub] [airflow] potiuk opened a new pull request #20935: Fix all Amazon Provider MyPy errors

potiuk opened a new pull request #20935:
URL: https://github.com/apache/airflow/pull/20935


   Part of #19891
   
   <!--
   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 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/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+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 [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787678986



##########
File path: airflow/providers/amazon/aws/operators/eks.py
##########
@@ -281,29 +282,31 @@ class EksCreateNodegroupOperator(BaseOperator):
     def __init__(
         self,
         cluster_name: str,
-        nodegroup_subnets: List[str],
+        nodegroup_subnets: Union[List[str], str],
         nodegroup_role_arn: str,
-        nodegroup_name: Optional[str] = DEFAULT_NODEGROUP_NAME,
+        nodegroup_name: str = DEFAULT_NODEGROUP_NAME,
         create_nodegroup_kwargs: Optional[Dict] = None,
         aws_conn_id: str = DEFAULT_CONN_ID,
         region: Optional[str] = None,
         **kwargs,
     ) -> None:
         self.cluster_name = cluster_name
-        self.nodegroup_subnets = nodegroup_subnets
         self.nodegroup_role_arn = nodegroup_role_arn
         self.nodegroup_name = nodegroup_name
         self.create_nodegroup_kwargs = create_nodegroup_kwargs or {}
         self.aws_conn_id = aws_conn_id
         self.region = region
+        if isinstance(nodegroup_subnets, str):
+            self.nodegroup_subnets = cast(List, literal_eval(nodegroup_subnets))
+        else:
+            self.nodegroup_subnets = nodegroup_subnets

Review comment:
       Oh yes we are `        nodegroup_subnets="{{ dag_run.conf['nodegroup_subnets'] }}",`




-- 
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



[GitHub] [airflow] potiuk closed pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk closed pull request #20935:
URL: https://github.com/apache/airflow/pull/20935


   


-- 
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



[GitHub] [airflow] potiuk commented on pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#issuecomment-1016397846


   With this one (and some merged yesterday) will get to 29 MyPy errors left ! 


-- 
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



[GitHub] [airflow] potiuk commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r789010395



##########
File path: airflow/providers/amazon/aws/operators/cloud_formation.py
##########
@@ -44,17 +44,17 @@ class CloudFormationCreateStackOperator(BaseOperator):
     template_ext: Sequence[str] = ()
     ui_color = '#6b9659'
 
-    def __init__(self, *, stack_name: str, params: dict, aws_conn_id: str = 'aws_default', **kwargs):
+    def __init__(self, *, stack_name: str, parameters: dict, aws_conn_id: str = 'aws_default', **kwargs):

Review comment:
       Separated it out and added breaking notes in #20989 




-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787676482



##########
File path: airflow/providers/amazon/aws/operators/cloud_formation.py
##########
@@ -44,17 +44,17 @@ class CloudFormationCreateStackOperator(BaseOperator):
     template_ext: Sequence[str] = ()
     ui_color = '#6b9659'
 
-    def __init__(self, *, stack_name: str, params: dict, aws_conn_id: str = 'aws_default', **kwargs):
+    def __init__(self, *, stack_name: str, parameters: dict, aws_conn_id: str = 'aws_default', **kwargs):

Review comment:
       (I'm okay with that, just FYI when releasing. Not sure if we need to note that here in this PR etc/)




-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787752745



##########
File path: airflow/providers/amazon/aws/operators/glue.py
##########
@@ -75,10 +75,10 @@ def __init__(
         *,
         job_name: str = 'aws_glue_default_job',
         job_desc: str = 'AWS Glue Job with Airflow',
-        script_location: Optional[str] = None,
+        script_location: str,

Review comment:
       https://github.com/apache/airflow/pull/20951




-- 
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



[GitHub] [airflow] potiuk commented on pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#issuecomment-1016207508


   All green now!


-- 
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



[GitHub] [airflow] potiuk merged pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk merged pull request #20935:
URL: https://github.com/apache/airflow/pull/20935


   


-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787678106



##########
File path: airflow/providers/amazon/aws/operators/eks.py
##########
@@ -281,29 +282,31 @@ class EksCreateNodegroupOperator(BaseOperator):
     def __init__(
         self,
         cluster_name: str,
-        nodegroup_subnets: List[str],
+        nodegroup_subnets: Union[List[str], str],
         nodegroup_role_arn: str,
-        nodegroup_name: Optional[str] = DEFAULT_NODEGROUP_NAME,
+        nodegroup_name: str = DEFAULT_NODEGROUP_NAME,
         create_nodegroup_kwargs: Optional[Dict] = None,
         aws_conn_id: str = DEFAULT_CONN_ID,
         region: Optional[str] = None,
         **kwargs,
     ) -> None:
         self.cluster_name = cluster_name
-        self.nodegroup_subnets = nodegroup_subnets
         self.nodegroup_role_arn = nodegroup_role_arn
         self.nodegroup_name = nodegroup_name
         self.create_nodegroup_kwargs = create_nodegroup_kwargs or {}
         self.aws_conn_id = aws_conn_id
         self.region = region
+        if isinstance(nodegroup_subnets, str):
+            self.nodegroup_subnets = cast(List, literal_eval(nodegroup_subnets))
+        else:
+            self.nodegroup_subnets = nodegroup_subnets

Review comment:
       This seems like more than a mypy fix but adding a feature -- are we currently using "string-containing-a-list" feature?




-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787680380



##########
File path: airflow/providers/amazon/aws/operators/glue.py
##########
@@ -75,10 +75,10 @@ def __init__(
         *,
         job_name: str = 'aws_glue_default_job',
         job_desc: str = 'AWS Glue Job with Airflow',
-        script_location: Optional[str] = None,
+        script_location: str,

Review comment:
       Type in docstring doesn't match.




-- 
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



[GitHub] [airflow] potiuk commented on pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#issuecomment-1018000191


   Hey @ashb  - all should be good  here. (and really close to finish MyPy).


-- 
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



[GitHub] [airflow] potiuk commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787734988



##########
File path: airflow/providers/amazon/aws/operators/glue.py
##########
@@ -75,10 +75,10 @@ def __init__(
         *,
         job_name: str = 'aws_glue_default_job',
         job_desc: str = 'AWS Glue Job with Airflow',
-        script_location: Optional[str] = None,
+        script_location: str,

Review comment:
       OH YEAH!




-- 
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



[GitHub] [airflow] potiuk commented on pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#issuecomment-1017843966


   Looks like going to be Green :) 


-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787678409



##########
File path: airflow/providers/amazon/aws/operators/eks.py
##########
@@ -281,29 +282,31 @@ class EksCreateNodegroupOperator(BaseOperator):
     def __init__(
         self,
         cluster_name: str,
-        nodegroup_subnets: List[str],
+        nodegroup_subnets: Union[List[str], str],
         nodegroup_role_arn: str,
-        nodegroup_name: Optional[str] = DEFAULT_NODEGROUP_NAME,
+        nodegroup_name: str = DEFAULT_NODEGROUP_NAME,
         create_nodegroup_kwargs: Optional[Dict] = None,
         aws_conn_id: str = DEFAULT_CONN_ID,
         region: Optional[str] = None,
         **kwargs,
     ) -> None:
         self.cluster_name = cluster_name
-        self.nodegroup_subnets = nodegroup_subnets
         self.nodegroup_role_arn = nodegroup_role_arn
         self.nodegroup_name = nodegroup_name
         self.create_nodegroup_kwargs = create_nodegroup_kwargs or {}
         self.aws_conn_id = aws_conn_id
         self.region = region
+        if isinstance(nodegroup_subnets, str):
+            self.nodegroup_subnets = cast(List, literal_eval(nodegroup_subnets))
+        else:
+            self.nodegroup_subnets = nodegroup_subnets

Review comment:
       If we keep it we should do more than a cast -- we should validate the type




-- 
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



[GitHub] [airflow] github-actions[bot] commented on pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#issuecomment-1018525452


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787676243



##########
File path: airflow/providers/amazon/aws/operators/cloud_formation.py
##########
@@ -44,17 +44,17 @@ class CloudFormationCreateStackOperator(BaseOperator):
     template_ext: Sequence[str] = ()
     ui_color = '#6b9659'
 
-    def __init__(self, *, stack_name: str, params: dict, aws_conn_id: str = 'aws_default', **kwargs):
+    def __init__(self, *, stack_name: str, parameters: dict, aws_conn_id: str = 'aws_default', **kwargs):

Review comment:
       This makes it a breaking change to the operator.




-- 
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



[GitHub] [airflow] potiuk commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787735921



##########
File path: airflow/providers/amazon/aws/operators/cloud_formation.py
##########
@@ -44,17 +44,17 @@ class CloudFormationCreateStackOperator(BaseOperator):
     template_ext: Sequence[str] = ()
     ui_color = '#6b9659'
 
-    def __init__(self, *, stack_name: str, params: dict, aws_conn_id: str = 'aws_default', **kwargs):
+    def __init__(self, *, stack_name: str, parameters: dict, aws_conn_id: str = 'aws_default', **kwargs):

Review comment:
       Yes. I realize that. I made a mental note about it but you are right I should add it to CHANGELOG now so that I won't forget




-- 
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



[GitHub] [airflow] ashb commented on a change in pull request #20935: Fix all Amazon Provider MyPy errors

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #20935:
URL: https://github.com/apache/airflow/pull/20935#discussion_r787734178



##########
File path: airflow/providers/amazon/aws/operators/glue.py
##########
@@ -75,10 +75,10 @@ def __init__(
         *,
         job_name: str = 'aws_glue_default_job',
         job_desc: str = 'AWS Glue Job with Airflow',
-        script_location: Optional[str] = None,
+        script_location: str,

Review comment:
       I have a change coming that fixes this - since we upgraded Sphinx-autoapi recently we can now use type-hints in docs, meaning we can remove all the `:type` lines!




-- 
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