Airflow Relative Importing Outside /dag Directory

前端 未结 3 1282
故里飘歌
故里飘歌 2021-02-09 02:12

I haven\'t been able to move common code outside of the dag directory that airflow uses. I\'ve looked in the airflow source and found imp.load_source.

Is it possible to

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-09 03:15

    Other way instead of adding __init__.py file is to add the following include at the top of dag script:

    import sys
    import os
    sys.path.insert(0,os.path.abspath(os.path.dirname(__file__)))
    

提交回复
热议问题