jason810496 opened a new pull request, #61436:
URL: https://github.com/apache/airflow/pull/61436

   ## Why
   
   The default dags path in Breeze will be `/files/dags`, but `/files/dags` is 
not in `PYTHONPATH`, which cause the triggers defined in Dag file are not able 
to import by Triggerer, and have to workaround by copying Dag file to some 
directories that are in `PYTHONPATH`. Pointed out in: 
https://github.com/apache/airflow/issues/58676#issuecomment-3845092376
   
   ## What
   
   We should add `/files/dags` to `PYTHONPATH` in Breeze in case the triggers 
are defined in dags, and cause "unable to import trigger" during Triggerer 
runtime.
   
   
   **Before**: `/files/dags` is not in `PYTHONPATH`
   ```bash
   >>> import sys; import pprint; pprint.pprint(sys.path)
   ['',
    '/opt/airflow',
    '/opt/airflow/providers/standard/tests',
    '/usr/python/lib/python310.zip',
    '/usr/python/lib/python3.10',
   # ...
    '/opt/airflow/providers/yandex/src',
   ```
   
   **After**: `/files/dags` is now in `PYTHONPATH`
   
   ```bash
   >>> import sys; import pprint; pprint.pprint(sys.path)
   ['',
    '/opt/airflow',
    '/files/dags',  # <----------------------------- added!
    '/opt/airflow/providers/standard/tests',
    '/usr/python/lib/python310.zip',
    '/usr/python/lib/python3.10',
    '/usr/python/lib/python3.10/lib-dynload',
    '/usr/python/lib/python3.10/site-packages',
    '/opt/airflow/airflow-core/src',
    '/opt/airflow/airflow-ctl/src',
    ...
   ```


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

Reply via email to