mik-laj commented on a change in pull request #7217: [AIRFLOW-5946] Store
source code in db
URL: https://github.com/apache/airflow/pull/7217#discussion_r391739979
##########
File path: airflow/www/views.py
##########
@@ -519,17 +519,23 @@ def last_dagruns(self, session=None):
@has_access
@provide_session
def code(self, session=None):
- dm = models.DagModel
- dag_id = request.args.get('dag_id')
- dag = session.query(dm).filter(dm.dag_id == dag_id).first()
+ all_errors = ""
+
try:
- with wwwutils.open_maybe_zipped(dag.fileloc, 'r') as f:
- code = f.read()
+ dag_id = request.args.get('dag_id')
+ dag_orm = DagModel.get_dagmodel(dag_id, session=session)
+ dag = dag_orm.get_dag(STORE_SERIALIZED_DAGS)
Review comment:
Why do we need DAG here? Is DagModel not enough? In the `dag_code.html` file
we read only dag_id.
----------------------------------------------------------------
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