You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/04/25 15:09:08 UTC

[airflow] branch main updated (b45240ad21 -> d4a3348055)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


    from b45240ad21 Allow extra to be nullable in connection payload as per schema(REST API). (#23183)
     new 48abf571be Add `endpoint_id` arg to `google.cloud.operators.vertex_ai.CreateEndpointOperator`
     new 27af0b7ebe Add the new parameter to the docstring
     new 6b459995b2 Add the format of Vertex Endpoint ID to the docstrings
     new d4a3348055 Update the TEST_ENDPOINT_ID to use the valid format

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py   | 4 ++++
 .../providers/google/cloud/operators/vertex_ai/endpoint_service.py   | 5 +++++
 .../providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py  | 5 +++++
 tests/providers/google/cloud/operators/test_vertex_ai.py             | 4 +++-
 4 files changed, 17 insertions(+), 1 deletion(-)


[airflow] 03/04: Add the format of Vertex Endpoint ID to the docstrings

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 6b459995b260cc7023e4720974ef4f59893cd283
Author: cont-m-nakagawa <na...@gmail.com>
AuthorDate: Wed Apr 20 16:31:24 2022 +0900

    Add the format of Vertex Endpoint ID to the docstrings
---
 airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py     | 3 ++-
 airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py b/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
index dcf521a978..63307fed15 100644
--- a/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
+++ b/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
@@ -92,7 +92,8 @@ class EndpointServiceHook(GoogleBaseHook):
         :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
         :param region: Required. The ID of the Google Cloud region that the service belongs to.
         :param endpoint: Required. The Endpoint to create.
-        :param endpoint_id: The ID of Endpoint. If not provided, Vertex AI will generate a value for this ID.
+        :param endpoint_id: The ID of Endpoint. This value should be 1-10 characters, and valid characters
+            are /[0-9]/. If not provided, Vertex AI will generate a value for this ID.
         :param retry: Designation of what errors, if any, should be retried.
         :param timeout: The timeout for this request.
         :param metadata: Strings which should be sent along with the request as metadata.
diff --git a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
index 935575a5fc..3706836e58 100644
--- a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
+++ b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
@@ -55,7 +55,8 @@ class CreateEndpointOperator(BaseOperator):
     :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
     :param region: Required. The ID of the Google Cloud region that the service belongs to.
     :param endpoint: Required. The Endpoint to create.
-    :param endpoint_id: The ID of Endpoint. If not provided, Vertex AI will generate a value for this ID.
+    :param endpoint_id: The ID of Endpoint. This value should be 1-10 characters, and valid characters
+        are /[0-9]/. If not provided, Vertex AI will generate a value for this ID.
     :param retry: Designation of what errors, if any, should be retried.
     :param timeout: The timeout for this request.
     :param metadata: Strings which should be sent along with the request as metadata.


[airflow] 04/04: Update the TEST_ENDPOINT_ID to use the valid format

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit d4a33480550db841657b998c0b4464feffec0ef9
Author: cont-m-nakagawa <na...@gmail.com>
AuthorDate: Wed Apr 20 16:32:06 2022 +0900

    Update the TEST_ENDPOINT_ID to use the valid format
---
 tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py | 2 +-
 tests/providers/google/cloud/operators/test_vertex_ai.py              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py b/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
index 146a1a555e..ac49e3bae5 100644
--- a/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
+++ b/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
@@ -31,7 +31,7 @@ TEST_GCP_CONN_ID: str = "test-gcp-conn-id"
 TEST_REGION: str = "test-region"
 TEST_PROJECT_ID: str = "test-project-id"
 TEST_ENDPOINT: dict = {}
-TEST_ENDPOINT_ID: str = "test_endpoint_id"
+TEST_ENDPOINT_ID: str = "1234567890"
 TEST_ENDPOINT_NAME: str = "test_endpoint_name"
 TEST_DEPLOYED_MODEL: dict = {}
 TEST_DEPLOYED_MODEL_ID: str = "test-deployed-model-id"
diff --git a/tests/providers/google/cloud/operators/test_vertex_ai.py b/tests/providers/google/cloud/operators/test_vertex_ai.py
index e90cc3e2ee..51e6674344 100644
--- a/tests/providers/google/cloud/operators/test_vertex_ai.py
+++ b/tests/providers/google/cloud/operators/test_vertex_ai.py
@@ -148,7 +148,7 @@ TEST_BATCH_PREDICTION_JOB_ID = "test_batch_prediction_job_id"
 TEST_ENDPOINT = {
     "display_name": "endpoint_test",
 }
-TEST_ENDPOINT_ID = "test_endpoint_id"
+TEST_ENDPOINT_ID = "1234567890"
 TEST_DEPLOYED_MODEL = {
     # format: 'projects/{project}/locations/{location}/models/{model}'
     'model': f"projects/{GCP_PROJECT}/locations/{GCP_LOCATION}/models/test_model_id",


[airflow] 01/04: Add `endpoint_id` arg to `google.cloud.operators.vertex_ai.CreateEndpointOperator`

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 48abf571bec483b0198802e79fb9b948ba41fdd1
Author: cont-m-nakagawa <na...@gmail.com>
AuthorDate: Tue Apr 19 15:15:36 2022 +0900

    Add `endpoint_id` arg to `google.cloud.operators.vertex_ai.CreateEndpointOperator`
---
 airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py   | 3 +++
 .../providers/google/cloud/operators/vertex_ai/endpoint_service.py   | 3 +++
 .../providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py  | 5 +++++
 tests/providers/google/cloud/operators/test_vertex_ai.py             | 2 ++
 4 files changed, 13 insertions(+)

diff --git a/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py b/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
index 9cbe470f97..dcf521a978 100644
--- a/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
+++ b/airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py
@@ -81,6 +81,7 @@ class EndpointServiceHook(GoogleBaseHook):
         project_id: str,
         region: str,
         endpoint: Union[Endpoint, Dict],
+        endpoint_id: Optional[str] = None,
         retry: Union[Retry, _MethodDefault] = DEFAULT,
         timeout: Optional[float] = None,
         metadata: Sequence[Tuple[str, str]] = (),
@@ -91,6 +92,7 @@ class EndpointServiceHook(GoogleBaseHook):
         :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
         :param region: Required. The ID of the Google Cloud region that the service belongs to.
         :param endpoint: Required. The Endpoint to create.
+        :param endpoint_id: The ID of Endpoint. If not provided, Vertex AI will generate a value for this ID.
         :param retry: Designation of what errors, if any, should be retried.
         :param timeout: The timeout for this request.
         :param metadata: Strings which should be sent along with the request as metadata.
@@ -102,6 +104,7 @@ class EndpointServiceHook(GoogleBaseHook):
             request={
                 'parent': parent,
                 'endpoint': endpoint,
+                'endpoint_id': endpoint_id,
             },
             retry=retry,
             timeout=timeout,
diff --git a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
index 67d40dd1b6..bb7aa45dd4 100644
--- a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
+++ b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
@@ -81,6 +81,7 @@ class CreateEndpointOperator(BaseOperator):
         region: str,
         project_id: str,
         endpoint: Union[Endpoint, Dict],
+        endpoint_id: Optional[str] = None,
         retry: Union[Retry, _MethodDefault] = DEFAULT,
         timeout: Optional[float] = None,
         metadata: Sequence[Tuple[str, str]] = (),
@@ -93,6 +94,7 @@ class CreateEndpointOperator(BaseOperator):
         self.region = region
         self.project_id = project_id
         self.endpoint = endpoint
+        self.endpoint_id = endpoint_id
         self.retry = retry
         self.timeout = timeout
         self.metadata = metadata
@@ -112,6 +114,7 @@ class CreateEndpointOperator(BaseOperator):
             project_id=self.project_id,
             region=self.region,
             endpoint=self.endpoint,
+            endpoint_id=self.endpoint_id,
             retry=self.retry,
             timeout=self.timeout,
             metadata=self.metadata,
diff --git a/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py b/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
index 0c6cf6c54e..146a1a555e 100644
--- a/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
+++ b/tests/providers/google/cloud/hooks/vertex_ai/test_endpoint_service.py
@@ -31,6 +31,7 @@ TEST_GCP_CONN_ID: str = "test-gcp-conn-id"
 TEST_REGION: str = "test-region"
 TEST_PROJECT_ID: str = "test-project-id"
 TEST_ENDPOINT: dict = {}
+TEST_ENDPOINT_ID: str = "test_endpoint_id"
 TEST_ENDPOINT_NAME: str = "test_endpoint_name"
 TEST_DEPLOYED_MODEL: dict = {}
 TEST_DEPLOYED_MODEL_ID: str = "test-deployed-model-id"
@@ -54,12 +55,14 @@ class TestEndpointServiceWithDefaultProjectIdHook(TestCase):
             project_id=TEST_PROJECT_ID,
             region=TEST_REGION,
             endpoint=TEST_ENDPOINT,
+            endpoint_id=TEST_ENDPOINT_ID,
         )
         mock_client.assert_called_once_with(TEST_REGION)
         mock_client.return_value.create_endpoint.assert_called_once_with(
             request=dict(
                 parent=mock_client.return_value.common_location_path.return_value,
                 endpoint=TEST_ENDPOINT,
+                endpoint_id=TEST_ENDPOINT_ID,
             ),
             metadata=(),
             retry=DEFAULT,
@@ -223,12 +226,14 @@ class TestEndpointServiceWithoutDefaultProjectIdHook(TestCase):
             project_id=TEST_PROJECT_ID,
             region=TEST_REGION,
             endpoint=TEST_ENDPOINT,
+            endpoint_id=TEST_ENDPOINT_ID,
         )
         mock_client.assert_called_once_with(TEST_REGION)
         mock_client.return_value.create_endpoint.assert_called_once_with(
             request=dict(
                 parent=mock_client.return_value.common_location_path.return_value,
                 endpoint=TEST_ENDPOINT,
+                endpoint_id=TEST_ENDPOINT_ID,
             ),
             metadata=(),
             retry=DEFAULT,
diff --git a/tests/providers/google/cloud/operators/test_vertex_ai.py b/tests/providers/google/cloud/operators/test_vertex_ai.py
index f5fca7d3d8..e90cc3e2ee 100644
--- a/tests/providers/google/cloud/operators/test_vertex_ai.py
+++ b/tests/providers/google/cloud/operators/test_vertex_ai.py
@@ -1137,6 +1137,7 @@ class TestVertexAICreateEndpointOperator:
             region=GCP_LOCATION,
             project_id=GCP_PROJECT,
             endpoint=TEST_ENDPOINT,
+            endpoint_id=TEST_ENDPOINT_ID,
             retry=RETRY,
             timeout=TIMEOUT,
             metadata=METADATA,
@@ -1149,6 +1150,7 @@ class TestVertexAICreateEndpointOperator:
             region=GCP_LOCATION,
             project_id=GCP_PROJECT,
             endpoint=TEST_ENDPOINT,
+            endpoint_id=TEST_ENDPOINT_ID,
             retry=RETRY,
             timeout=TIMEOUT,
             metadata=METADATA,


[airflow] 02/04: Add the new parameter to the docstring

Posted by po...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 27af0b7ebe1641d998b890858b0081ccf1472add
Author: Mai Nakagawa <na...@gmail.com>
AuthorDate: Wed Apr 20 10:00:22 2022 +0900

    Add the new parameter to the docstring
---
 airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
index bb7aa45dd4..935575a5fc 100644
--- a/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
+++ b/airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py
@@ -55,6 +55,7 @@ class CreateEndpointOperator(BaseOperator):
     :param project_id: Required. The ID of the Google Cloud project that the service belongs to.
     :param region: Required. The ID of the Google Cloud region that the service belongs to.
     :param endpoint: Required. The Endpoint to create.
+    :param endpoint_id: The ID of Endpoint. If not provided, Vertex AI will generate a value for this ID.
     :param retry: Designation of what errors, if any, should be retried.
     :param timeout: The timeout for this request.
     :param metadata: Strings which should be sent along with the request as metadata.