Skip to content
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

Allow per-timetable ordering override in grid view #25633

Merged
merged 3 commits into from
Aug 18, 2022

Conversation

uranusjr
Copy link
Member

Close #25090.

I wonder if there are any other views that would benefit from this custom ordering logic.

@boring-cyborg boring-cyborg bot added the area:webserver Webserver related Issues label Aug 10, 2022
@bbovenzi
Copy link
Contributor

I seem to be having a problem if there are also manually triggered runs, they're all appended to the end, regardless of date.
Screen Shot 2022-08-10 at 2 09 28 PM

@uranusjr
Copy link
Member Author

What schedule does the DAG use?

@bbovenzi
Copy link
Contributor

What schedule does the DAG use?

That one was a dataset-triggered. A regular schedule seems to work fine though

@uranusjr
Copy link
Member Author

Ah makes sense, I’ll add a special case for them.

@@ -3622,8 +3622,10 @@ def grid_data(self):
if run_state:
query = query.filter(DagRun.state == run_state)

dag_runs = query.order_by(DagRun.execution_date.desc()).limit(num_runs).all()
ordering = (DagRun.__table__.columns[name].desc() for name in dag.timetable.run_ordering)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have the UI read ordering in order to know when to use data_interval_end as a label instead of data_interval_start?

Copy link
Member Author

@uranusjr uranusjr Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should. I added a field dag_run_ordering in the response JSON that’s a list of DAG run fields used for ordering. Would this be enough?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that'll be good. But let's do that as a subsequent PR since it breaks a lot of tests and needs a bunch of UI changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the addition.

@uranusjr uranusjr force-pushed the timetable-ordering-logic branch 2 times, most recently from 39f7dbe to 273c6b2 Compare August 16, 2022 23:04
Copy link
Contributor

@bbovenzi bbovenzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm once tests pass and then I'll work on the UI part.

@uranusjr

This comment was marked as outdated.

Previously dataset-triggered runs don't set the data interval an
implicitly uses the compatibility fallback mechanism. This works fine,
but creates weird result when the DAG runs are ordered by data interval
fields because those NULL data intervals would sort differently against
non-NULL values created by manual runs. This is fixed by explicitly
providing the data interval when we create the dataset-triggered run, so
those fields are populated when the run is created in the database.
These don't really have a notion of data intervals, so it's better to
order them by logical date. The result shouldn't be different, but this
makes the code easier to understand.
@uranusjr uranusjr merged commit 36eea1c into apache:main Aug 18, 2022
@uranusjr uranusjr deleted the timetable-ordering-logic branch August 18, 2022 06:28
@jedcunningham jedcunningham added the type:new-feature Changelog: New Features label Sep 12, 2022
@ephraimbuddy ephraimbuddy added this to the Airflow 2.4.0 milestone Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:webserver Webserver related Issues type:new-feature Changelog: New Features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

More natural sorting of DAG runs in the grid view
4 participants