[AIRFLOW-2776] Compress tree view JSON

The tree view generates JSON that can be massive
for bigger DAGs,
up to 10s of MBs. The JSON is currently
prettified, which both
takes up more CPU time during serialization, and
slows down
everything else that uses it. Considering the JSON
is only
meant to be used programmatically, this is an easy
win

Closes #3620 from abdul-stripe/smaller-tree-view-
json
This commit is contained in:
Abdul Nimeri 2018-07-26 20:53:57 +02:00 коммит произвёл Bolke de Bruin
Родитель 4cd72b91bd
Коммит 68535d1886
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -1477,7 +1477,8 @@ class Airflow(BaseView):
for d in dates],
}
data = json.dumps(data, indent=4, default=json_ser)
# minimize whitespace as this can be huge for bigger dags
data = json.dumps(data, default=json_ser, separators=(',', ':'))
session.commit()
form = DateTimeWithNumRunsForm(data={'base_date': max_date,

Просмотреть файл

@ -1208,7 +1208,8 @@ class Airflow(AirflowBaseView):
for d in dates],
}
data = json.dumps(data, indent=4, default=json_ser)
# minimize whitespace as this can be huge for bigger dags
data = json.dumps(data, default=json_ser, separators=(',', ':'))
session.commit()
form = DateTimeWithNumRunsForm(data={'base_date': max_date,