vincbeck commented on code in PR #39592:
URL: https://github.com/apache/airflow/pull/39592#discussion_r1599010536


##########
tests/system/providers/amazon/aws/example_comprehend.py:
##########
@@ -0,0 +1,140 @@
+# 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.
+from __future__ import annotations
+
+import json
+from datetime import datetime
+
+from airflow import DAG
+from airflow.decorators import task_group
+from airflow.models.baseoperator import chain
+from airflow.operators.empty import EmptyOperator
+from airflow.providers.amazon.aws.operators.comprehend import 
ComprehendStartPiiEntitiesDetectionJobOperator
+from airflow.providers.amazon.aws.operators.s3 import (
+    S3CreateBucketOperator,
+    S3CreateObjectOperator,
+    S3DeleteBucketOperator,
+)
+from airflow.providers.amazon.aws.sensors.comprehend import (
+    ComprehendStartPiiEntitiesDetectionJobCompletedSensor,
+)
+from airflow.utils.trigger_rule import TriggerRule
+from tests.system.providers.amazon.aws.utils import SystemTestContextBuilder
+
+ROLE_ARN_KEY = "ROLE_ARN"
+sys_test_context_task = 
SystemTestContextBuilder().add_variable(ROLE_ARN_KEY).build()
+
+DAG_ID = "example_comprehend"
+INPUT_S3_KEY_START_PII_ENTITIES_DETECTION_JOB = 
"start-pii-entities-detection-job/sample_data.txt"
+
+SAMPLE_DATA = {
+    "username": "bob1234",
+    "name": "Bob",
+    "sex": "M",
+    "address": "1773 Raymond Ville Suite 682",
+    "mail": "t...@hotmail.com",
+}
+
+
+@task_group
+def pii_entities_detection_job_workflow():
+    # [START howto_operator_start_pii_entities_detection_job]
+    start_pii_entities_detection_job = 
ComprehendStartPiiEntitiesDetectionJobOperator(
+        task_id="start_pii_entities_detection_job",
+        input_data_config=input_data_configurations,
+        output_data_config=output_data_configurations,
+        mode="ONLY_REDACTION",
+        data_access_role_arn=test_context[ROLE_ARN_KEY],
+        language_code="en",
+        start_pii_entities_kwargs=pii_entities_kwargs,
+    )
+    # [END howto_operator_start_pii_entities_detection_job]
+    start_pii_entities_detection_job.wait_for_completion = False
+
+    # [START howto_sensor_start_pii_entities_detection_job]
+    await_start_pii_entities_detection_job = 
ComprehendStartPiiEntitiesDetectionJobCompletedSensor(
+        task_id="await_start_pii_entities_detection_job", 
job_id=start_pii_entities_detection_job.output
+    )
+    # [END howto_sensor_start_pii_entities_detection_job]
+
+    end_workflow = EmptyOperator(task_id="end_workflow", 
trigger_rule=TriggerRule.NONE_FAILED_MIN_ONE_SUCCESS)

Review Comment:
   Why this task?



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

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to