mik-laj commented on a change in pull request #5720: [AIRFLOW-5099] Implement Google Cloud AutoML operators URL: https://github.com/apache/airflow/pull/5720#discussion_r317268905
########## File path: airflow/gcp/hooks/automl.py ########## @@ -0,0 +1,733 @@ +# -*- coding: utf-8 -*- +# +# 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. +# +""" +This module contains a Google AutoML hook. +""" +from typing import Dict, Sequence, Tuple, Union, List +from cached_property import cached_property + +from google.api_core.retry import Retry +from google.cloud.automl_v1beta1 import PredictionServiceClient, AutoMlClient +from google.cloud.automl_v1beta1.types import ( + BatchPredictInputConfig, + BatchPredictOutputConfig, + Model, + ExamplePayload, + Dataset, + FieldMask, + ImageObjectDetectionModelDeploymentMetadata, + PredictResponse, + ColumnSpec, + Operation, + TableSpec, + InputConfig, +) + +from airflow.contrib.hooks.gcp_api_base_hook import GoogleCloudBaseHook + + +class CloudAutoMLHook(GoogleCloudBaseHook): + """ + Google Cloud AutoML hook. + + All the methods in the hook where project_id is used must be called with + keyword arguments rather than positional. + """ + + def __init__(self, gcp_conn_id: str = "google_cloud_default", delegate_to=None): + super().__init__(gcp_conn_id, delegate_to) + self._client = None + + @staticmethod + def extract_object_id(obj: dict) -> str: Review comment: ```suggestion def extract_object_id(obj: Dict) -> str: ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
