:py:mod:`astronomer.providers.apache.livy.triggers.livy` ======================================================== .. py:module:: astronomer.providers.apache.livy.triggers.livy .. autoapi-nested-parse:: This module contains the Apache Livy Trigger. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: astronomer.providers.apache.livy.triggers.livy.LivyTrigger .. py:class:: LivyTrigger(batch_id, spark_params, livy_conn_id = 'livy_default', polling_interval = 0, extra_options = None, extra_headers = None, livy_hook_async = None) Bases: :py:obj:`airflow.triggers.base.BaseTrigger` Check for the state of a previously submitted job with batch_id :param batch_id: Batch job id :param spark_params: Spark parameters; for example, spark_params = {"file": "test/pi.py", "class_name": "org.apache.spark.examples.SparkPi", "args": ["/usr/lib/spark/bin/run-example", "SparkPi", "10"],"jars": "command-runner.jar", "driver_cores": 1, "executor_cores": 4,"num_executors": 1} :param livy_conn_id: reference to a pre-defined Livy Connection. :param polling_interval: time in seconds between polling for job completion. If poll_interval=0, in that case return the batch_id and if polling_interval > 0, poll the livy job for termination in the polling interval defined. :param extra_options: A dictionary of options, where key is string and value depends on the option that's being modified. :param extra_headers: A dictionary of headers passed to the HTTP request to livy. :param livy_hook_async: LivyHookAsync object .. py:method:: serialize() Serializes LivyTrigger arguments and classpath. .. py:method:: run() :async: Checks if the _polling_interval > 0, in that case it pools Livy for batch termination asynchrnonously. else returns the success response .. py:method:: poll_for_termination(batch_id) :async: Pool Livy for batch termination asynchrnonously. :param batch_id: id of the batch session to monitor.