A more involved PR like you suggest might be valuable in the long run, but in the short term I've been successful in the past with simply modifying the fileloc attribute of DAGs. It get's set here <https://github.com/apache/airflow/blob/master/airflow/models/dag.py#L229> to the previous frame, but you could override it once you've created the DAG object.
Chris On Tue, Aug 13, 2019 at 2:31 PM Shaw, Damian P. < damian.sha...@credit-suisse.com> wrote: > Hi all, > > I'm in need of being able to manipulate the code view for many of my DAGs > which are generated by a single Python script that reads config files. My > DAG creation script is getting increasingly less useful to the end users so > I would like to instead present the config file that was used to generate > the DAG. > > I took a look at the relevant code vide code in Airflow: > https://github.com/apache/airflow/blob/3e2a02751cf890b780bc26b40c7cee7f1f4e0bd9/airflow/www/views.py#L433 > > It seems it would be a relatively easy change to add an extra option on > the DAG, e.g. "dag.code_display_file" and maybe also a Lexer option, then > detect if this option has been set for the DAG in the above location and > display the specified file instead. > > I don't have any experience contributing to open source projects of this > size, would this be a welcome pull request? I'd rather not waste anyone's > time if it isn't. > > Thanks, > Damian > > =============================================================================== > > Please access the attached hyperlink for an important electronic > communications disclaimer: > http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html > =============================================================================== > >