ferruzzi edited a comment on issue #19641:
URL: https://github.com/apache/airflow/issues/19641#issuecomment-993113732


   How do we feel about [this 
implementation](https://github.com/ferruzzi/airflow/tree/kwargs-kpo)?  The 
required parameters are still there in named args, but if they are not passed, 
then it checks the operator_kwargs for their values.  So all three of these are 
valid:
   
   Pass only the required values by name:
   ```
   create_nodegroup = EKSCreateNodegroupOperator(
       task_id='create_eks_nodegroup',
       cluster_name=cluster_name,
       nodegroup_name=node_group_name,
       nodegroup_subnets=get_subnets(),
       nodegroup_role_arn=get_node_role(),
   )
   ```
   
   Pass the required values by name and the optional values in an 
operator_kwargs
   ```
   create_nodegroup = EKSCreateNodegroupOperator(
       task_id='create_eks_nodegroup',
       cluster_name=cluster_name,
       nodegroup_name=node_group_name,
       nodegroup_subnets=get_subnets(),
       nodegroup_role_arn=get_node_role(),
       create_nodegroup_kwargs={
           amiType = "BOTTLEROCKET_x86_64",
           instanceTypes = "t3.large",
           capacityType = "ON_DEMAND"
       }
   )
   ```
   
   Pass everything in as operator_kwargs:
   ```
   create_nodegroup = EKSCreateNodegroupOperator(
       task_id='create_eks_nodegroup',
       create_nodegroup_kwargs={
           cluster_name=cluster_name,
           nodegroup_name=node_group_name,
           nodegroup_subnets=get_subnets(),
           nodegroup_role_arn=get_node_role(),
           amiType = "BOTTLEROCKET_x86_64",
           instanceTypes = "t3.large",
           capacityType = "ON_DEMAND"
       }
   )
   ```
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to