Taragolis opened a new pull request, #33727:
URL: https://github.com/apache/airflow/pull/33727

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   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 an 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/
   -->
   
   
   This would fix checks in `main`
   
   ```console
   ERROR: There were some import errors
   
   Detected that this job is about installing providers in 2.4.0,
   most likely you are using features that are not available in Airflow 2.4.0
   and you must implement them in backwards-compatible way!
   
   
   ----------------------------------------
   Exception when importing: 
airflow.providers.microsoft.azure.example_dag.example_azure_batch_operator
   
   
   Traceback (most recent call last):
     File "/opt/airflow/scripts/in_container/verify_providers.py", line 202, in 
import_all_classes
       _module = importlib.import_module(modinfo.name)
     File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in 
import_module
       return _bootstrap._gcd_import(name, package, level)
     File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
     File "<frozen importlib._bootstrap>", line 991, in _find_and_load
     File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 843, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in 
_call_with_frames_removed
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/example_dag/example_azure_batch_operator.py",
 line 45, in <module>
       azure_batch_operator = AzureBatchOperator(
     File 
"/usr/local/lib/python3.8/site-packages/airflow/models/baseoperator.py", line 
408, in apply_defaults
       result = func(self, **kwargs, default_args=default_args)
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/operators/batch.py",
 line 179, in __init__
       self.hook = self.get_hook()
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/operators/batch.py",
 line 315, in get_hook
       return AzureBatchHook(azure_batch_conn_id=self.azure_batch_conn_id)
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/hooks/batch.py",
 line 80, in __init__
       self.connection = self.get_conn()
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/hooks/batch.py",
 line 93, in get_conn
       conn = self._connection()
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/microsoft/azure/hooks/batch.py",
 line 84, in _connection
       conn = self.get_connection(self.conn_id)
     File "/usr/local/lib/python3.8/site-packages/airflow/hooks/base.py", line 
70, in get_connection
       conn = Connection.get_connection_from_secrets(conn_id)
     File 
"/usr/local/lib/python3.8/site-packages/airflow/models/connection.py", line 
432, in get_connection_from_secrets
       raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
   airflow.exceptions.AirflowNotFoundException: The conn_id 
`azure_batch_default` isn't defined
   ```
   
   Seems like `AzureBatchOperator` not optimised and call connection during 
initialise 
   
   
https://github.com/apache/airflow/blob/7700fb12cc6c7a97901662e6ac6aa1e4e932d969/airflow/providers/microsoft/azure/operators/batch.py#L179
   
   
https://github.com/apache/airflow/blob/3a0b8bded98a1f8256765e5b829c2ba4f1b0369a/airflow/providers/microsoft/azure/hooks/batch.py#L79-L80
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ 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 changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+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 a 
newsfragment file, named `{pr_number}.significant.rst` or 
`{issue_number}.significant.rst`, in 
[newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


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