You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/06 10:40:58 UTC

[GitHub] [airflow] bhirsz opened a new pull request, #22777: Migrate Dataproc to new system tests design

bhirsz opened a new pull request, #22777:
URL: https://github.com/apache/airflow/pull/22777

   Migrate Dataproc system tests/example dags to be compliant with new design ([AIP-47](https://cwiki.apache.org/confluence/display/AIRFLOW/AIP-47+New+design+of+Airflow+System+Tests)). 
   
   Covers airflow/providers/google/cloud/example_dags/example_dataproc.py from #22447


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk merged pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #22777:
URL: https://github.com/apache/airflow/pull/22777


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #22777:
URL: https://github.com/apache/airflow/pull/22777#issuecomment-1108701301

   Running tests now.


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #22777:
URL: https://github.com/apache/airflow/pull/22777#issuecomment-1117910383

   Tests are failing I am afraid


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] bhirsz commented on a diff in pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
bhirsz commented on code in PR #22777:
URL: https://github.com/apache/airflow/pull/22777#discussion_r843819438


##########
tests/system/providers/google/dataproc/example_dataproc_workflow.py:
##########
@@ -0,0 +1,103 @@
+# 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.
+
+"""
+Example Airflow DAG for Dataproc workflow operators.
+"""
+
+import os
+from datetime import datetime
+
+from airflow import models
+from airflow.providers.google.cloud.operators.dataproc import (
+    DataprocCreateWorkflowTemplateOperator,
+    DataprocInstantiateInlineWorkflowTemplateOperator,
+    DataprocInstantiateWorkflowTemplateOperator,
+)
+
+ENV_ID = os.environ["SYSTEM_TESTS_ENV_ID"]
+DAG_ID = "dataproc_workflow"
+PROJECT_ID = os.environ["SYSTEM_TESTS_GCP_PROJECT"]
+REGION = "europe-west1"
+CLUSTER_NAME = f"cluster-dataproc-workflow-{ENV_ID}"
+CLUSTER_CONFIG = {
+    "master_config": {
+        "num_instances": 1,
+        "machine_type_uri": "n1-standard-4",
+        "disk_config": {"boot_disk_type": "pd-standard", "boot_disk_size_gb": 1024},
+    },
+    "worker_config": {
+        "num_instances": 2,
+        "machine_type_uri": "n1-standard-4",
+        "disk_config": {"boot_disk_type": "pd-standard", "boot_disk_size_gb": 1024},
+    },
+}
+PIG_JOB = {"query_list": {"queries": ["define sin HiveUDF('sin');"]}}
+WORKFLOW_NAME = "airflow-dataproc-test"
+WORKFLOW_TEMPLATE = {
+    "id": WORKFLOW_NAME,
+    "placement": {
+        "managed_cluster": {
+            "cluster_name": CLUSTER_NAME,
+            "config": CLUSTER_CONFIG,
+        }
+    },
+    "jobs": [{"step_id": "pig_job_1", "pig_job": PIG_JOB}],
+}
+
+
+with models.DAG(
+    DAG_ID,
+    schedule_interval='@once',
+    start_date=datetime(2021, 1, 1),
+    catchup=False,
+    tags=["example", "dataproc"],
+) as dag:
+    # [START how_to_cloud_dataproc_create_workflow_template]
+    create_workflow_template = DataprocCreateWorkflowTemplateOperator(
+        task_id="create_workflow_template",
+        template=WORKFLOW_TEMPLATE,
+        project_id=PROJECT_ID,
+        region=REGION,
+    )
+    # [END how_to_cloud_dataproc_create_workflow_template]
+
+    # [START how_to_cloud_dataproc_trigger_workflow_template]
+    trigger_workflow = DataprocInstantiateWorkflowTemplateOperator(
+        task_id="trigger_workflow", region=REGION, project_id=PROJECT_ID, template_id=WORKFLOW_NAME
+    )
+    # [END how_to_cloud_dataproc_trigger_workflow_template]
+
+    # [START how_to_cloud_dataproc_instantiate_inline_workflow_template]
+    instantiate_inline_workflow_template = DataprocInstantiateInlineWorkflowTemplateOperator(
+        task_id='instantiate_inline_workflow_template', template=WORKFLOW_TEMPLATE, region=REGION
+    )
+    # [END how_to_cloud_dataproc_instantiate_inline_workflow_template]
+
+    create_workflow_template >> trigger_workflow

Review Comment:
   I see I missed instantiate_inline_workflow_template from the dependencies, I will update it.



-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] bhirsz commented on a diff in pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
bhirsz commented on code in PR #22777:
URL: https://github.com/apache/airflow/pull/22777#discussion_r843816978


##########
tests/always/test_project_structure.py:
##########
@@ -244,10 +243,15 @@ def test_missing_example_for_operator(self):
             }
             all_operators -= example_paths
 
+        covered_but_omitted = self.MISSING_EXAMPLES_FOR_OPERATORS - all_operators
         all_operators -= self.MISSING_EXAMPLES_FOR_OPERATORS
         all_operators -= self.DEPRECATED_OPERATORS
         all_operators -= self.BASE_OPERATORS
-        assert set() == all_operators
+        assert set() == all_operators, (

Review Comment:
   Also updated the tests to fail if some operators are set as not covered with examples but example is found.



-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] github-actions[bot] commented on pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #22777:
URL: https://github.com/apache/airflow/pull/22777#issuecomment-1096981758

   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] potiuk commented on pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #22777:
URL: https://github.com/apache/airflow/pull/22777#issuecomment-1108702279

   Ah. Needs rebase due to conflicts @bhirsz 


-- 
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-unsubscribe@airflow.apache.org

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


[GitHub] [airflow] bhirsz commented on pull request #22777: Migrate Dataproc to new system tests design

Posted by GitBox <gi...@apache.org>.
bhirsz commented on PR #22777:
URL: https://github.com/apache/airflow/pull/22777#issuecomment-1117930945

   > Tests are failing I am afraid
   
   The PR stalled over time a bit - I will fix it. 


-- 
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-unsubscribe@airflow.apache.org

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