Source code for airflow.providers.databricks.triggers.databricks
## 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__future__importannotationsimportasyncioimportloggingfromtypingimportAnyfromairflow.providers.databricks.hooks.databricksimportDatabricksHooktry:fromairflow.triggers.baseimportBaseTrigger,TriggerEventexceptImportError:logging.getLogger(__name__).warning('Deferrable Operators only work starting Airflow 2.2',exc_info=True,)
[docs]classDatabricksExecutionTrigger(BaseTrigger):""" The trigger handles the logic of async communication with DataBricks API. :param run_id: id of the run :param databricks_conn_id: Reference to the :ref:`Databricks connection <howto/connection:databricks>`. :param polling_period_seconds: Controls the rate of the poll for the result of this run. By default, the trigger will poll every 30 seconds. """def__init__(self,run_id:int,databricks_conn_id:str,polling_period_seconds:int=30)->None:super().__init__()self.run_id=run_idself.databricks_conn_id=databricks_conn_idself.polling_period_seconds=polling_period_secondsself.hook=DatabricksHook(databricks_conn_id)