ashb commented on a change in pull request #4291: [AIRFLOW-1488] Add the TriggeredDagRunSensor operator URL: https://github.com/apache/airflow/pull/4291#discussion_r300400225
########## File path: airflow/contrib/sensors/triggered_dagrun_sensor.py ########## @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +# +# Licensed 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. +"""Contains the TriggeredDagSensor which allows for checking the status +of triggered DAG runs.""" +from airflow.exceptions import AirflowException +from airflow.utils import db +from airflow.utils.state import State +from airflow.utils.decorators import apply_defaults +from airflow.utils.trigger_rule import TriggerRule +from airflow.models import DagRun +from airflow.sensors.base_sensor_operator import BaseSensorOperator + + +class TriggeredDagRunSensor(BaseSensorOperator): + """ + Waits for triggered DAG run(s) to complete and checks status. + + :param trigger_task_id: The id of the task that triggered the dags + and returns a list of dagrun ids to monitor. + :type trigger_task_id: str + :param sensor_rule: criteria for success after dagruns complete. + Default is ``TriggerRule.ONE_SUCCESS`` + :type sensor_rule: str + """ + @apply_defaults + def __init__( + self, + trigger_task_id, + sensor_rule=None, Review comment: ```suggestion sensor_rule=TriggerRule.ONE_SUCCESS, ``` ---------------------------------------------------------------- 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
