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 2020/02/19 11:26:14 UTC

[GitHub] [airflow] roitvt commented on a change in pull request #7163: [AIRFLOW-6542] add spark-on-k8s operator/hook/sensor

roitvt commented on a change in pull request #7163: [AIRFLOW-6542] add spark-on-k8s operator/hook/sensor
URL: https://github.com/apache/airflow/pull/7163#discussion_r381233175
 
 

 ##########
 File path: airflow/providers/cncf/kubernetes/operators/spark_kubernetes_operator.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.
+from typing import Optional
+
+import yaml
+from kubernetes import client
+
+from airflow.exceptions import AirflowException
+from airflow.models import BaseOperator
+from airflow.providers.cncf.kubernetes.hooks.kubernetes_hook import Kuberneteshook
+from airflow.utils.decorators import apply_defaults
+
+
+class SparkKubernetesOperator(BaseOperator):
+    """
+    Creates sparkApplication object in kubernetes cluster:
+       .. seealso::
+        For more detail about Spark Application Object have a look at the reference:
+        https://github.com/GoogleCloudPlatform/spark-on-k8s-operator/blob/master/docs/api-docs.md#sparkapplication
+
+    :param sparkapplication_file: filepath to kubernetes custom_resource_definition of sparkApplication
+    :type sparkapplication_file:  str
+    :param namespace: kubernetes namespace to put sparkApplication
+    :type namespace: str
+    :param conn_id: the connection to Kubernetes cluster
+    :type conn_id: str
+    """
+
+    template_fields = ['sparkapplication_file', 'namespace']
+    template_ext = ('yaml', 'yml', 'json')
+    ui_color = '#f4a460'
+
+    @apply_defaults
+    def __init__(self,
+                 sparkapplication_file: str,
 
 Review comment:
   Can you be more specific?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services