Skip to content

Conversation

@jroachgolf84
Copy link
Collaborator

This pull request adds the last_asset_event_id and last_asset_event_timestamp fields to the AssetResponse model, and thus, the /assets endpoint. The original use-case was to make the Asset list view sortable by the last Asset Event. However, there is a much larger use-case at play here; the ability to easily determine the timestamp for the last Asset Event for a certain Asset. This is especially applicable for Asset Watchers.

By default, the last_asset_event_id and last_asset_event_timestamp fields are returned as null. It's not until the first Asset Event that these fields are populated.

Unit-tests were added/updated for all changes made.

related: #47164

@boring-cyborg boring-cyborg bot added area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers. labels May 1, 2025
@jroachgolf84
Copy link
Collaborator Author

@pierrejeambrun, @bbovenzi, #49994 closed in favor of this PR.

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.

Manually testing in the UI and lgtm.

@pierrejeambrun can you take a look for the API portion? We'll want to add sorting and filtering soon.

Copy link
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

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

Overall looks good. I only have a comment related to a loop in the code :) Thanks for the PR!

Copy link
Contributor

@bugraoz93 bugraoz93 left a comment

Choose a reason for hiding this comment

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

Thanks for the update! Looks good

@jroachgolf84
Copy link
Collaborator Author

Changed implemented!

Copy link
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Just wondering if last_asset_event_id and last_asset_event_timestamp shouldn't be flat in the asset model but in a nested object such as:

   "last_asset_event": {
       "id": 
       "timestamp":
   }

(A lighter version of the AssetEventResponse)

That's a minor detail but if we later need more fields from the last asset event, then we will have all those field flats mixed up with the asset model.

@pierrejeambrun pierrejeambrun added this to the Airflow 3.1.0 milestone May 5, 2025
@jroachgolf84
Copy link
Collaborator Author

Looks good to me.

Just wondering if last_asset_event_id and last_asset_event_timestamp shouldn't be flat in the asset model but in a nested object such as:

   "last_asset_event": {
       "id": 
       "timestamp":
   }

(A lighter version of the AssetEventResponse)

That's a minor detail but if we later need more fields from the last asset event, then we will have all those field flats mixed up with the asset model.

I think that makes total sense. I'll go ahead and implement that this morning.

@jroachgolf84
Copy link
Collaborator Author

@pierrejeambrun, I've gone ahead and implemented that change!

Copy link
Contributor

@rawwar rawwar left a comment

Choose a reason for hiding this comment

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

Thanks! Looking good. Just a few nits

@pierrejeambrun
Copy link
Member

Unrelated CI failure, merging.

@pierrejeambrun pierrejeambrun merged commit 64c91b7 into apache:main May 6, 2025
91 of 94 checks passed
@pierrejeambrun
Copy link
Member

pierrejeambrun commented May 6, 2025

Thanks @jroachgolf84!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:airflow-ctl area:API Airflow's REST/HTTP API area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants