| :py:mod:`airflow.providers.google.cloud.hooks.automl` |
| ===================================================== |
| |
| .. py:module:: airflow.providers.google.cloud.hooks.automl |
| |
| .. autoapi-nested-parse:: |
| |
| This module contains a Google AutoML hook. |
| |
| .. spelling:: |
| |
| PredictResponse |
| |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.google.cloud.hooks.automl.CloudAutoMLHook |
| |
| |
| |
| |
| .. py:class:: CloudAutoMLHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None) |
| |
| Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook` |
| |
| Google Cloud AutoML hook. |
| |
| All the methods in the hook where project_id is used must be called with |
| keyword arguments rather than positional. |
| |
| .. py:method:: extract_object_id(obj) |
| :staticmethod: |
| |
| Returns unique id of the object. |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Retrieves connection to AutoML. |
| |
| :return: Google Cloud AutoML client object. |
| :rtype: google.cloud.automl_v1beta1.AutoMlClient |
| |
| |
| .. py:method:: prediction_client(self) |
| |
| Creates PredictionServiceClient. |
| |
| :return: Google Cloud AutoML PredictionServiceClient client object. |
| :rtype: google.cloud.automl_v1beta1.PredictionServiceClient |
| |
| |
| .. py:method:: create_model(self, model, location, project_id = PROVIDE_PROJECT_ID, timeout = None, metadata = (), retry = DEFAULT) |
| |
| Creates a model_id. Returns a Model in the `response` field when it |
| completes. When you create a model, several model evaluations are |
| created for it: a global evaluation, and one evaluation for each |
| annotation spec. |
| |
| :param model: The model_id to create. If a dict is provided, it must be of the same form |
| as the protobuf message `google.cloud.automl_v1beta1.types.Model` |
| :param project_id: ID of the Google Cloud project where model will be created if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests |
| will not be retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. |
| Note that if `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance |
| |
| |
| .. py:method:: batch_predict(self, model_id, input_config, output_config, location, project_id = PROVIDE_PROJECT_ID, params = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Perform a batch prediction. Unlike the online `Predict`, batch |
| prediction result won't be immediately available in the response. |
| Instead, a long running operation object is returned. |
| |
| :param model_id: Name of the model_id requested to serve the batch prediction. |
| :param input_config: Required. The input configuration for batch prediction. |
| If a dict is provided, it must be of the same form as the protobuf message |
| `google.cloud.automl_v1beta1.types.BatchPredictInputConfig` |
| :param output_config: Required. The Configuration specifying where output predictions should be |
| written. If a dict is provided, it must be of the same form as the protobuf message |
| `google.cloud.automl_v1beta1.types.BatchPredictOutputConfig` |
| :param params: Additional domain-specific parameters for the predictions, any string must be up to |
| 25000 characters long. |
| :param project_id: ID of the Google Cloud project where model is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance |
| |
| |
| .. py:method:: predict(self, model_id, payload, location, project_id = PROVIDE_PROJECT_ID, params = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Perform an online prediction. The prediction result will be directly |
| returned in the response. |
| |
| :param model_id: Name of the model_id requested to serve the prediction. |
| :param payload: Required. Payload to perform a prediction on. The payload must match the problem type |
| that the model_id was trained to solve. If a dict is provided, it must be of |
| the same form as the protobuf message `google.cloud.automl_v1beta1.types.ExamplePayload` |
| :param params: Additional domain-specific parameters, any string must be up to 25000 characters long. |
| :param project_id: ID of the Google Cloud project where model is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types.PredictResponse` instance |
| |
| |
| .. py:method:: create_dataset(self, dataset, location, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Creates a dataset. |
| |
| :param dataset: The dataset to create. If a dict is provided, it must be of the |
| same form as the protobuf message Dataset. |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types.Dataset` instance. |
| |
| |
| .. py:method:: import_data(self, dataset_id, location, input_config, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Imports data into a dataset. For Tables this method can only be called on an empty Dataset. |
| |
| :param dataset_id: Name of the AutoML dataset. |
| :param input_config: The desired input location and its domain specific semantics, if any. |
| If a dict is provided, it must be of the same form as the protobuf message InputConfig. |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance |
| |
| |
| .. py:method:: list_column_specs(self, dataset_id, table_spec_id, location, project_id = PROVIDE_PROJECT_ID, field_mask = None, filter_ = None, page_size = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Lists column specs in a table spec. |
| |
| :param dataset_id: Name of the AutoML dataset. |
| :param table_spec_id: table_spec_id for path builder. |
| :param field_mask: Mask specifying which fields to read. If a dict is provided, it must be of the same |
| form as the protobuf message `google.cloud.automl_v1beta1.types.FieldMask` |
| :param filter_: Filter expression, see go/filtering. |
| :param page_size: The maximum number of resources contained in the |
| underlying API response. If page streaming is performed per |
| resource, this parameter does not affect the return value. If page |
| streaming is performed per-page, this determines the maximum number |
| of resources in a page. |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types.ColumnSpec` instance. |
| |
| |
| .. py:method:: get_model(self, model_id, location, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Gets a AutoML model. |
| |
| :param model_id: Name of the model. |
| :param project_id: ID of the Google Cloud project where model is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types.Model` instance. |
| |
| |
| .. py:method:: delete_model(self, model_id, location, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Deletes a AutoML model. |
| |
| :param model_id: Name of the model. |
| :param project_id: ID of the Google Cloud project where model is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance. |
| |
| |
| .. py:method:: update_dataset(self, dataset, update_mask = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Updates a dataset. |
| |
| :param dataset: The dataset which replaces the resource on the server. |
| If a dict is provided, it must be of the same form as the protobuf message Dataset. |
| :param update_mask: The update mask applies to the resource. If a dict is provided, it must |
| be of the same form as the protobuf message FieldMask. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types.Dataset` instance.. |
| |
| |
| .. py:method:: deploy_model(self, model_id, location, project_id = PROVIDE_PROJECT_ID, image_detection_metadata = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Deploys a model. If a model is already deployed, deploying it with the same parameters |
| has no effect. Deploying with different parameters (as e.g. changing node_number) will |
| reset the deployment state without pausing the model_id’s availability. |
| |
| Only applicable for Text Classification, Image Object Detection and Tables; all other |
| domains manage deployment automatically. |
| |
| :param model_id: Name of the model requested to serve the prediction. |
| :param image_detection_metadata: Model deployment metadata specific to Image Object Detection. |
| If a dict is provided, it must be of the same form as the protobuf message |
| ImageObjectDetectionModelDeploymentMetadata |
| :param project_id: ID of the Google Cloud project where model will be created if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance. |
| |
| |
| .. py:method:: list_table_specs(self, dataset_id, location, project_id = None, filter_ = None, page_size = None, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Lists table specs in a dataset_id. |
| |
| :param dataset_id: Name of the dataset. |
| :param filter_: Filter expression, see go/filtering. |
| :param page_size: The maximum number of resources contained in the |
| underlying API response. If page streaming is performed per |
| resource, this parameter does not affect the return value. If page |
| streaming is performed per-page, this determines the maximum number |
| of resources in a page. |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: A `google.gax.PageIterator` instance. By default, this |
| is an iterable of `google.cloud.automl_v1beta1.types.TableSpec` instances. |
| This object can also be configured to iterate over the pages |
| of the response through the `options` parameter. |
| |
| |
| .. py:method:: list_datasets(self, location, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Lists datasets in a project. |
| |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: A `google.gax.PageIterator` instance. By default, this |
| is an iterable of `google.cloud.automl_v1beta1.types.Dataset` instances. |
| This object can also be configured to iterate over the pages |
| of the response through the `options` parameter. |
| |
| |
| .. py:method:: delete_dataset(self, dataset_id, location, project_id, retry = DEFAULT, timeout = None, metadata = ()) |
| |
| Deletes a dataset and all of its contents. |
| |
| :param dataset_id: ID of dataset to be deleted. |
| :param project_id: ID of the Google Cloud project where dataset is located if None then |
| default project_id is used. |
| :param location: The location of the project. |
| :param retry: A retry object used to retry requests. If `None` is specified, requests will not be |
| retried. |
| :param timeout: The amount of time, in seconds, to wait for the request to complete. Note that if |
| `retry` is specified, the timeout applies to each individual attempt. |
| :param metadata: Additional metadata that is provided to the method. |
| |
| :return: `google.cloud.automl_v1beta1.types._OperationFuture` instance |
| |
| |
| |