jedcunningham opened a new pull request #18753:
URL: https://github.com/apache/airflow/pull/18753
We need to mount the DAGs in the triggerer, as triggers could come from
the DAGs themselves.
Example DAG to demonstrate this, named `custom_trigger.py`, in the root of
the DAGS dir:
```
from datetime import datetime
from airflow import DAG
from airflow.models import BaseOperator
from airflow.triggers.base import BaseTrigger, TriggerEvent
class CustomSuccessTrigger(BaseTrigger):
def serialize(self):
return ("custom_trigger.CustomSuccessTrigger", {})
async def run(self):
yield TriggerEvent(True)
class CustomOperator(BaseOperator):
def execute(self, context):
self.defer(trigger=CustomSuccessTrigger(), method_name="next")
def next(self, context, event=None):
return None
with DAG(
"custom_trigger", schedule_interval=None, start_date=datetime(2021, 10,
1)
) as dag:
CustomOperator(task_id="run")
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]