GLaDAP opened a new issue, #34451:
URL: https://github.com/apache/airflow/issues/34451

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### What happened
   
   We are running Apache Airflow 2.6.1, Python 3.8 and 
apache-airflow-providers-google 10.8.0. 
   We want to list the Vertex AI Endpoints in a Google Cloud Project with 
the`airflow.providers.google.cloud.operators.vertex_ai.endpoint_service.ListEndpointsOperator`.
 However, when running the DAG, the operator returns an error stating the 
response is not an instance of Endpoint. It does display the information about 
the Endpoint in the logs.
   
   The stack trace is shown below:
   ```
   [2023-09-18, 11:24:37 UTC] {taskinstance.py:1824} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py",
 line 456, in execute
       return [Endpoint.to_dict(result) for result in results]
     File 
"/usr/local/lib/python3.8/site-packages/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py",
 line 456, in <listcomp>
       return [Endpoint.to_dict(result) for result in results]
     File "/usr/local/lib/python3.8/site-packages/proto/message.py", line 406, 
in to_dict
       cls.pb(instance),
     File "/usr/local/lib/python3.8/site-packages/proto/message.py", line 291, 
in pb
       raise TypeError("%r is not an instance of %s" % (obj, cls.__name__,))
   name: "projects/<project_id>/locations/europe-west4/endpoints/<endpoint_id>"
   display_name: "demo-endpoint"
   description: "model-endpoint"
   deployed_models {
     dedicated_resources {
       machine_spec {
         machine_type: "n1-standard-2"
       }
       min_replica_count: 1
       max_replica_count: 1
     }
     id: "<endpoint_id>"
     model: "projects/<project>/locations/europe-west4/models/<model_id>"
     model_version_id: "1"
     display_name: "endpoint_test"
     create_time {
       seconds: 1695031973
       nanos: 292536000
     }
     service_account: <service_account>
     enable_access_logging: true
   }
   traffic_split {
     key: <key>
     value: 100
   }
   etag: "<etag>"
   labels {
     key: "source"
     value: "airflow"
   }
   create_time {
     seconds: 1695031963
     nanos: 480401000
   }
   update_time {
     seconds: 1695032127
     nanos: 514426000
   }
    is not an instance of Endpoint
   [2023-09-18, 11:24:37 UTC] {taskinstance.py:1345} INFO - Marking task as 
FAILED.
   ```
   
   Note that sensitive information is replaced in the log above.
   
   ### What you think should happen instead
   
   We expected a successful dag run listing the endpoints in the target project.
   
   ### How to reproduce
   
   The DAG is shown below:
   ```
   from datetime import datetime
   from airflow.decorators import dag
   from airflow.providers.google.cloud.operators.vertex_ai.endpoint_service 
import (
       ListEndpointsOperator,
   )
   
   @dag(
       dag_id="vertexai-list-endpoints-dag",
       description="Example of listing endpoints",
       start_date=datetime(2023, 9, 15)
   )
   def list_endpoints_example():
           
       list_endpoints_operators = ListEndpointsOperator(
           task_id="vertexai-list-endpoints",
           project_id="<PROJECT_ID>",
           region="europe-west4"
       )
   
       list_endpoints_operators
   list_endpoints_example()
   ```
   
   ### Operating System
   
   Debian 11 Bullseye
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-google==10.8.0
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   This problem occurs every run (fails always)
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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: [email protected]

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

Reply via email to