apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
37.12k stars 14.3k forks source link

Google Vertex AI ListEndpointsOperator fails with `TypeError: is not an instance of Endpoint` when listing Endpoints #34451

Closed GLaDAP closed 11 months ago

GLaDAP commented 1 year ago

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 theairflow.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?

Code of Conduct

boring-cyborg[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

eladkal commented 1 year ago

Accorsing to https://github.com/apache/airflow/pull/34582#issuecomment-1792637149 the issue was not repeoduced.

Can you please recheck?

github-actions[bot] commented 11 months ago

This issue has been automatically marked as stale because it has been open for 14 days with no response from the author. It will be closed in next 7 days if no further activity occurs from the issue author.

github-actions[bot] commented 11 months ago

This issue has been closed because it has not received response from the issue author.