jaketf commented on a change in pull request #10673:
URL: https://github.com/apache/airflow/pull/10673#discussion_r481273255



##########
File path: airflow/providers/google/cloud/sensors/dataproc.py
##########
@@ -0,0 +1,83 @@
+#
+# 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 Dataproc Job sensor.
+"""
+from typing import Optional
+
+from airflow.providers.google.cloud.hooks.dataproc import DataprocHook
+from airflow.sensors.base_sensor_operator import BaseSensorOperator
+from airflow.utils.decorators import apply_defaults
+from google.cloud.dataproc_v1beta2.types import JobStatus
+
+
+class DataprocJobSensor(BaseSensorOperator):
+    """
+    Check for the state of a job submitted to a Dataproc cluster.
+
+    :param gcp_conn_id: The connection ID to use connecting to Google Cloud 
Platform.
+    :type gcp_conn_id: str
+    :param dataproc_job_id: The Dataproc job ID to poll
+    :type dataproc_job_id: str
+    :param delegate_to: The account to impersonate, if any.
+        For this to work, the service account making the request must have 
domain-wide
+        delegation enabled.
+    :type delegate_to: str
+    """
+    template_fields = ('project_id', 'location', 'dataproc_job_id')
+    ui_color = '#f0eee4'
+    CANCEL_STATES = set([JobStatus.CANCEL_PENDING, JobStatus.CANCEL_STARTED, 
JobStatus.CANCELLED])
+
+    @apply_defaults
+    def __init__(self,
+                 project_id:str,
+                 gcp_conn_id: str = 'google_cloud_default',
+                 dataproc_job_id: str = None,
+                 location: str = 'global',

Review comment:
       +1 to region should be a required parameter.




----------------------------------------------------------------
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]


Reply via email to