Skip to content

feat: add arbitrary metadata GET/POST endpoints #9130

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

Merged
merged 16 commits into from
Jun 13, 2024

Conversation

corban-beaird
Copy link
Contributor

@corban-beaird corban-beaird commented Apr 9, 2024

Ticket

ET-48

Description

Add support for storing arbitrary metadata associated with a given run. Additionally, this sets the groundwork for filtering runs based on flat_key-value pairs.

Test Plan

  • Automated integration testing for API
  • Automated unit testing

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Copy link

netlify bot commented Apr 9, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 2367ef8
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/666b1727e0c43a00087055c8

Copy link

codecov bot commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 54.29688% with 117 lines in your changes missing coverage. Please review.

Project coverage is 48.99%. Comparing base (e3d01c1) to head (2367ef8).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #9130    +/-   ##
========================================
  Coverage   48.98%   48.99%            
========================================
  Files        1238     1240     +2     
  Lines      160518   160772   +254     
  Branches     2783     2784     +1     
========================================
+ Hits        78629    78763   +134     
- Misses      81714    81834   +120     
  Partials      175      175            
Flag Coverage Δ
backend 43.91% <62.79%> (+0.05%) ⬆️
harness 63.80% <36.90%> (-0.06%) ⬇️
web 44.13% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
master/internal/api_experiment.go 56.79% <100.00%> (+0.02%) ⬆️
master/internal/db/postgres_trial.go 62.61% <100.00%> (ø)
master/pkg/model/experiment.go 14.63% <100.00%> (+0.34%) ⬆️
master/internal/api_runs.go 63.19% <82.75%> (+0.89%) ⬆️
harness/determined/core/_train.py 39.83% <33.33%> (-1.08%) ⬇️
master/internal/run/runs.go 87.09% <87.09%> (ø)
harness/determined/common/api/bindings.py 40.21% <37.33%> (-0.02%) ⬇️
master/internal/db/postgres_runs.go 0.00% <0.00%> (ø)

... and 3 files with indirect coverage changes

@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from 77eaf89 to a3d5165 Compare April 9, 2024 15:59
@corban-beaird corban-beaird marked this pull request as ready for review April 9, 2024 16:16
@corban-beaird corban-beaird requested a review from a team as a code owner April 9, 2024 16:16
Copy link
Contributor

@NicholasBlaskey NicholasBlaskey left a comment

Choose a reason for hiding this comment

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

My main comment is about the product question

@corban-beaird corban-beaird requested a review from a team as a code owner April 11, 2024 16:02
@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from 72c28d4 to a323e14 Compare April 17, 2024 22:10
@azhou-determined
Copy link
Contributor

is there a way for someone to delete keys from the metadata or is that out of scope for this?

@corban-beaird
Copy link
Contributor Author

is there a way for someone to delete keys from the metadata or is that out of scope for this?

@azhou-determined
Not currently, I do believe it's out of scope for this PR, but I don't see a reason why we shouldn't add it to the backlog of items to knock out with this project.

How granular are we wanting to allow a metadata to be deleted? I would be in favor of allowing requests to be made on at a key level + the ability to delete all arbitrary metadata on a given run at once.

@azhou-determined
Copy link
Contributor

is there a way for someone to delete keys from the metadata or is that out of scope for this?

@azhou-determined Not currently, I do believe it's out of scope for this PR, but I don't see a reason why we shouldn't add it to the backlog of items to knock out with this project.

How granular are we wanting to allow a metadata to be deleted? I would be in favor of allowing requests to be made on at a key level + the ability to delete all arbitrary metadata on a given run at once.

i guess if we're going with the "only set/update, never add/merge" approach, we don't really need to surface a way to delete. as you mentioned, set_metadata(metadata=None) seems logical to me. i think we should have remove if we go with add though.

@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch 4 times, most recently from 92f7cde to 05f3fbc Compare May 22, 2024 15:50
@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from 8e16475 to 5b2bad3 Compare May 30, 2024 18:06
@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from 5b2bad3 to a447850 Compare June 3, 2024 15:38
Copy link
Contributor

@azhou-determined azhou-determined left a comment

Choose a reason for hiding this comment

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

python side lgtm

@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from 2ad69b4 to 08a9ed5 Compare June 6, 2024 20:04
Copy link
Contributor

@NicholasBlaskey NicholasBlaskey 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

I think my only concern is the code duplication and the future of this. I would talk with @AmanuelAaron and see if we can design something that works for both cases?

)

// FlattenMetadata flattens a nested map of run metadata into a list of RunMetadataIndex entries.
func FlattenMetadata(
Copy link
Contributor

Choose a reason for hiding this comment

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

@AmanuelAaron just landed a PR that boils down to wanting to index hyperparameters

Is there a way we could only have one way of flattening / indexing JSONB in our code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would be down to make this more general & push it into a util file that can be shared!

}

// parseMetadataValueType converts a value to a string and returns the type of the value.
func parseMetadataValueType(rawValue any) (value string, valueType string) {
Copy link
Contributor

Choose a reason for hiding this comment

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

summary metrics does this same kinda thing

switch metricValue := metric.AsInterface().(type) {

would be cool if we only had one place where we did this, since it is easy to get wrong. I would check to see what happens if you report NaN in python code if it becomes a float

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds great! I'm down to improve the reuse!

@corban-beaird corban-beaird force-pushed the corban-arbitrary-metadata-get-post branch from f034c11 to ca6c095 Compare June 12, 2024 20:17
@corban-beaird corban-beaird merged commit d44013c into main Jun 13, 2024
84 of 98 checks passed
@corban-beaird corban-beaird deleted the corban-arbitrary-metadata-get-post branch June 13, 2024 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants