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

Only show latest dataset event timestamp after last run #38340

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ <h4 class="modal-title" id="datasetNextRunModalLabel">
<thead>
<tr>
<th>Dataset URI</th>
<th>Latest Update</th>
<th>Latest Update since last Dag Run</th>
</tr>
</thead>
<tbody id="datasets_tbody">
Expand Down
9 changes: 8 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3677,6 +3677,8 @@ def next_run_datasets(self, dag_id):
with create_session() as session:
dag_model = DagModel.get_dagmodel(dag_id, session=session)

latest_run = dag_model.get_last_dagrun(session=session)

events = [
dict(info)
for info in session.execute(
Expand All @@ -3698,7 +3700,12 @@ def next_run_datasets(self, dag_id):
)
.join(
DatasetEvent,
DatasetEvent.dataset_id == DatasetModel.id,
and_(
DatasetEvent.dataset_id == DatasetModel.id,
DatasetEvent.timestamp >= latest_run.execution_date
if latest_run and latest_run.execution_date
else True,
),
isouter=True,
)
.where(DagScheduleDatasetReference.dag_id == dag_id, ~DatasetModel.is_orphaned)
Expand Down