mik-laj commented on a change in pull request #5924: [AIRFLOW-5319] Add system 
tests for Dataproc
URL: https://github.com/apache/airflow/pull/5924#discussion_r319410633
 
 

 ##########
 File path: airflow/contrib/example_dags/example_gcp_dataproc.py
 ##########
 @@ -0,0 +1,130 @@
+# -*- 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.
+"""
+Example Airflow DAG that show how to use various Dataproc
+operators to manage a cluster and submit jobs.
+"""
+
+import os
+import airflow
+from airflow import models
+from airflow.contrib.operators.dataproc_operator import (
+    DataprocClusterCreateOperator,
+    DataprocClusterDeleteOperator,
+    DataprocClusterScaleOperator,
+    DataProcSparkSqlOperator,
+    DataProcSparkOperator,
+    DataProcPySparkOperator,
+    DataProcPigOperator,
+    DataProcHiveOperator,
+    DataProcHadoopOperator,
+)
+
+PROJECT_ID = os.environ.get("GCP_PROJECT_ID", "an-id")
+CLUSTER_NAME = os.environ.get("GCP_DATAPROC_CLUSTER_NAME", "example-project")
+REGION = os.environ.get("GCP_LOCATION", "europe-west1")
+ZONE = os.environ.get("GCP_REGION", "europe-west-1b")
+OUTPUT_BUCKET = os.environ.get("GCP_DATAPROC_OUTPUT_BUCKET", 
"system-tests-outputs")
+OUTPUT_FOLDER = "wordcount"
+OUTPUT_PATH = "gs://{}/{}/".format(OUTPUT_BUCKET, OUTPUT_FOLDER)
+
+PYSPARK_MAIN = os.environ.get(
+    "PYSPARK_MAIN",
+    
"gs://dataproc-examples-2f10d78d114f6aaec76462e3c310f31f/src/pyspark/hello-world/hello-world.py",
 
 Review comment:
   For two reasons:
   *  this bucket may disappear at any time. We will lose part of the project 
in this way.
   * it is not a good idea to download something from a random bucket and 
execute it. it is not safe, because the contents of the bucket may change. 

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

Reply via email to