-
Notifications
You must be signed in to change notification settings - Fork 16.4k
[AIRFLOW-3160] (Unrevert) Load latest_dagruns asynchronously #5339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -403,6 +403,33 @@ def task_stats(self, session=None): | |
| }) | ||
| return wwwutils.json_response(payload) | ||
|
|
||
| @expose('/last_dagruns') | ||
| @has_access | ||
| @provide_session | ||
| def last_dagruns(self, session=None): | ||
| DagRun = models.DagRun | ||
|
|
||
| filter_dag_ids = appbuilder.sm.get_accessible_dag_ids() | ||
|
|
||
| if not filter_dag_ids: | ||
| return | ||
|
|
||
| dags_to_latest_runs = dict(session.query( | ||
| DagRun.dag_id, sqla.func.max(DagRun.execution_date).label('execution_date')) | ||
| .group_by(DagRun.dag_id).all()) | ||
|
|
||
| payload = {} | ||
| for dag in dagbag.dags.values(): | ||
| dag_accessible = 'all_dags' in filter_dag_ids or dag.dag_id in filter_dag_ids | ||
| if (dag_accessible and dag.dag_id in dags_to_latest_runs and | ||
| dags_to_latest_runs[dag.dag_id]): | ||
| payload[dag.safe_dag_id] = { | ||
| 'dag_id': dag.dag_id, | ||
| 'last_run': dags_to_latest_runs[dag.dag_id].strftime("%Y-%m-%d %H:%M") | ||
|
||
| } | ||
|
|
||
| return wwwutils.json_response(payload) | ||
|
|
||
| @expose('/code') | ||
| @has_dag_access(can_dag_read=True) | ||
| @has_access | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image is wider than the div it's in - does it look okay?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks ok to me in my browser, I agree probably the settings can be cleaned up and this width is strange. This is copied from all of the other async loaded components.