You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "gopidesupavan (via GitHub)" <gi...@apache.org> on 2025/04/25 14:11:36 UTC

[PR] Fix gcp remote log module import in airflow local settings [airflow]

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

   Gcp log module path pointed to logs. causing ModuleNotFoundError.
   
   User reported in slack. https://apache-airflow.slack.com/archives/CCQ7EGB1P/p1745522030825469
   
   ```
   │ Traceback (most recent call last):                                                                                                                                                                                                                
   │   File "/home/airflow/.local/lib/python3.10/site-packages/airflow/logging_config.py", line 57, in load_logging_config                                                                                                                             
   │     logging_config = import_string(logging_class_path)                                                                                                                                                                                            
   │   File "/home/airflow/.local/lib/python3.10/site-packages/airflow/utils/module_loading.py", line 39, in import_string                                                                                                                             
   │     module = import_module(module_path)                                                                                                                                                                                                           
   │   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module                                                                                                                                                              
   │     return _bootstrap._gcd_import(name[level:], package, level)                                                                                                                                                                                   
   │   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import                                                                                                                                                                                 
   │   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load                                                                                                                                                                              
   │   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked                                                                                                                                                                     
   │   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked                                                                                                                                                                               
   │   File "<frozen importlib._bootstrap_external>", line 883, in exec_module                                                                                                                                                                         
   │   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed                                                                                                                                                                    
   │   File "/log_config/k8_log_config.py", line 8, in <module>                                                                                                                                                                                        
   │     from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG                                                                                                                                                            
   │   File "/home/airflow/.local/lib/python3.10/site-packages/airflow/config_templates/airflow_local_settings.py", line 183, in <module>                                                                                                              
   │     from airflow.providers.google.cloud.logs.gcs_task_handler import GCSRemoteLogIO                                                                                                                                                               
   │ ModuleNotFoundError: No module named 'airflow.providers.google.cloud.logs'      
   ```
   
   <!--
    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/
   -->
   
   
   
   <!-- 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-docs/05_pull_requests.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 [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2831495998

   ### Backport successfully created: v3-0-test
   
   <table>
                   <tr>
                       <th>Status</th>
                       <th>Branch</th>
                       <th>Result</th>
                   </tr>
                   <tr>
                       <td>✅</td>
                       <td>v3-0-test</td>
                       <td><a href="https://github.com/apache/airflow/pull/49802"><img src="https://img.shields.io/badge/PR-49802-blue" alt="PR Link"></a></td>
                   </tr>
               </table>


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2841696224

   > Any chance this gets released soon? We had high hopes for Airflow 3.0, but the upgrade is blocked because of this issue :(
   
   3.0.1 will be released on 7th May, so not too far now. Btw you can also apply patch since it is just 1-liner 


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "sgrzemski (via GitHub)" <gi...@apache.org>.
sgrzemski commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2875936011

   Well, 3.0.1 has the very same error that @ldacey posted...
   It's bugged. The docs says the remote_task_handler_kwargs should not be required. `gcp_keyfile_dict` does not exist when using Workload Identity.


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2830885376

   This needs to go v3-0-test ryt?


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on code in PR #49788:
URL: https://github.com/apache/airflow/pull/49788#discussion_r2060526490


##########
airflow-core/src/airflow/config_templates/airflow_local_settings.py:
##########
@@ -194,7 +194,7 @@
                 }
                 | remote_task_handler_kwargs
             )
-        )
+        )  # type: ignore[assignment]

Review Comment:
   uff its string declaration for upload method :)



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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb commented on code in PR #49788:
URL: https://github.com/apache/airflow/pull/49788#discussion_r2060352285


##########
airflow-core/src/airflow/config_templates/airflow_local_settings.py:
##########
@@ -194,7 +194,7 @@
                 }
                 | remote_task_handler_kwargs
             )
-        )
+        )  # type: ignore[assignment]

Review Comment:
   This ignore shouldn't be needed -- if it is it means there's a bug in the handler.



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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "ldacey (via GitHub)" <gi...@apache.org>.
ldacey commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2876653564

   > > I tried to update the local settings to fix the import error but then I ran into:
   > > ```
   > > GCSRemoteLogIO.__init__() missing 3 required positional arguments: 'gcp_keyfile_dict', 'scopes', and 'project_id'
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > Same conn_id I always used in Airflow 2. I don't have any of those things defined since I just use Workload Identity and add the service account annotations.
   > 
   > How your configuring this one?
   > 
   > You need to set them in the logging section in conf with `remote_task_handler_kwargs` as key
   
   There is no keyfile dict or keyfile path though, so hopefully we can pass null or an empty string. Even if we were not using workload identity, I would assume this information would be retrieved from the gcp_conn_id? We wouldn't add sensitive information like the keyfile dict to the values.yaml.


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "ashb (via GitHub)" <gi...@apache.org>.
ashb merged PR #49788:
URL: https://github.com/apache/airflow/pull/49788


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "sgrzemski (via GitHub)" <gi...@apache.org>.
sgrzemski commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2841664908

   Any chance this gets released soon? We had high hopes for Airflow 3.0, but the upgrade is blocked because of this issue :(


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on code in PR #49788:
URL: https://github.com/apache/airflow/pull/49788#discussion_r2060465578


##########
airflow-core/src/airflow/config_templates/airflow_local_settings.py:
##########
@@ -194,7 +194,7 @@
                 }
                 | remote_task_handler_kwargs
             )
-        )
+        )  # type: ignore[assignment]

Review Comment:
   i added this one `processors = ()` to GCSRemoteLogIO the error was gone in idea, but tbh i dont know whats happening mypy still gives me error in local. 
   
   I pushed lets see CI throws any error.



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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "gopidesupavan (via GitHub)" <gi...@apache.org>.
gopidesupavan commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2856938276

   > I tried to update the local settings to fix the import error but then I ran into:
   > 
   > ```
   > GCSRemoteLogIO.__init__() missing 3 required positional arguments: 'gcp_keyfile_dict', 'scopes', and 'project_id'
   > ```
   > 
   > Same conn_id I always used in Airflow 2. I don't have any of those things defined since I just use Workload Identity and add the service account annotations.
   
   How your configuring this one?
   
   You need to set them in the logging section in conf with `remote_task_handler_kwargs` as key 


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


Re: [PR] Fix gcp remote log module import in airflow local settings [airflow]

Posted by "ldacey (via GitHub)" <gi...@apache.org>.
ldacey commented on PR #49788:
URL: https://github.com/apache/airflow/pull/49788#issuecomment-2856461823

   I tried to update the local settings to fix the import error but then I ran into:
   
   ```
   GCSRemoteLogIO.__init__() missing 3 required positional arguments: 'gcp_keyfile_dict', 'scopes', and 'project_id'
   ```
   
   Same conn_id I always used in Airflow 2. I don't have any of those things defined since I just use Workload Identity and add the service account annotations.


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