airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] lucacavazzana commented on a change in pull request #6090: [AIRFLOW-5470] Add Apache Livy REST operator
Date Tue, 08 Oct 2019 10:02:43 GMT
lucacavazzana commented on a change in pull request #6090: [AIRFLOW-5470] Add Apache Livy REST
operator
URL: https://github.com/apache/airflow/pull/6090#discussion_r332431224
 
 

 ##########
 File path: airflow/contrib/operators/livy_operator.py
 ##########
 @@ -0,0 +1,175 @@
+# -*- 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.
+
+"""
+This module contains the Apache Livy operator.
+"""
+
+from time import sleep, gmtime, mktime
+
+from airflow.models import BaseOperator
+from airflow.utils.decorators import apply_defaults
+from airflow.exceptions import AirflowException
+from airflow.contrib.hooks.livy_hook import LivyHook, BatchState, TERMINAL_STATES
+
+
+class LivyOperator(BaseOperator):
+    """
+    :param file: Path of the  file containing the application to execute (required).
+    :type file: str
+    :param class_name: Application Java/Spark main class string.
+    :type class_name: str
+    :param args: Command line arguments for the application s.
+    :type args: list
+    :param jars: jars to be used in this sessions.
+    :type jars: list
+    :param py_files: Python files to be used in this session.
+    :type py_files: list
+    :param files: files to be used in this session.
+    :type files: list
+    :param driver_memory: Amount of memory to use for the driver process  string.
+    :type driver_memory: str
+    :param driver_cores: Number of cores to use for the driver process int.
+    :type driver_cores: str
+    :param executor_memory: Amount of memory to use per executor process  string.
+    :type executor_memory: str
+    :param executor_cores: Number of cores to use for each executor  int.
+    :type executor_cores: str
+    :param num_executors: Number of executors to launch for this session  int.
+    :type num_executors: str
+    :param archives: Archives to be used in this session.
+    :type archives: list
+    :param queue: The name of the YARN queue to which submitted string.
+    :type queue: str
+    :param name: The name of this session  string.
+    :type name: str
+    :param conf: Spark configuration properties.
+    :type conf: dict
+    :param proxy_user: User to impersonate when running the job.
+    :type proxy_user: str
+    :param livy_conn_id: reference to a pre-defined Livy Connection.
+    :type livy_conn_id: str
+    :param polling_interval: time in seconds between polling for job completion. Don't poll
for values >=0
+    :type polling_interval: int
+    :param timeout: for a value greater than zero, number of seconds to poll before killing
the batch.
+    :type timeout: int
+    """
+
+    @apply_defaults
+    def __init__(
+        self,
+        file=None,
+        args=None,
+        conf=None,
+        livy_conn_id='livy_default',
+        polling_interval=0,
+        timeout=24 * 3600,
+        *vargs,
+        **kwargs
 
 Review comment:
   yeah, like in `livy_hook.build_post_batch_body` I got bullied by pylint: too many arguments.
   Guess I'll simply disable the warning

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

Mime
View raw message