-
Notifications
You must be signed in to change notification settings - Fork 1.7k
HParams: Add new hparams selector factories #6323
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
Conversation
85b796b to
56d6e75
Compare
JamesHollyer
left a comment
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.
Most just comments for my own understanding.
| return combineDefaultHparamFilters(defaultFilterMaps); | ||
| } | ||
|
|
||
| const getHparamsDefaultFiltersForExperiments = createSelector( |
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.
So this is basically a selector with a prop right? All current calls use this?
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.
Yeah, exactly. It is only used a dependency of other selectors though
| ); | ||
|
|
||
| defaultFilterMaps.push(state.specs[experimentId].metric.defaultFilters); | ||
| export function getHparamFilterMapFromExperimentIds(experimentIds: string[]) { |
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 is the one we want to use in the future?
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.
Yes
| getMetricsDefaultFiltersForExperimentsFromExperimentIds(experimentIds), | ||
| (state, defaultFilterMap) => | ||
| getMetricFilterMapResultFunction(state, defaultFilterMap, experimentIds) | ||
| ) as MemoizedSelector<State, Map<string, IntervalFilter>>; |
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.
What is the purpose of this typecast?
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.
I was playing with the typing there for a while, I think this can actually be removed now
## Motivation for features / changes As part of the effort to bring hparams to the time series dashboard a handful of new selectors need to be created. Rather than further the practice of creating selectors with props ([which is deprecated](https://ngrx.io/guide/migration/v12)) I am choosing to create them using the recommended solution of a selector factory. Unfortunately selector factories don't play nicely with selectors dependent selectors WITH props. There are a handful of hacky solutions to this problem but I am opting to create new dependent selectors using the factory pattern. ## Technical description of changes I extracted the result functions from the existing selectors, then created new factories which call them with an additional closured parameter. ## Screenshots of UI changes None ## Detailed steps to verify changes work correctly (as executed by you) Tests should pass ## Alternate designs / implementations considered I could have just wrapped the existing selectors and then called them passing in the global state instead. I chose this approach instead with the hope of removing the old selectors in a later pr.
## Motivation for features / changes The runs table currently contains the logic to filter runs by hparams, unfortunately, this logic is not shared with the rest of the dashboard and so filtering runs this way does not actually effect what is shown on the dashboard. ## Technical description of changes I moved out a lot of utility functions from the runs table container into common selectors. I then created three selectors 1) `getRenderableRuns` A private selector to help with the readability of `getFilteredRenderableRuns` Gets all runs associated with the provided experiment ids 2) `getFilteredRenderableRuns` Gets all runs associated with the provided experiment ids while accounting for filters. 3) `getFilteredRenderableRunsFromRoute` Retrieves the experiment ids from the route then gets the filtered runs associated with them NOTE: The utility functions are encapsulated in a utils object so that they can be spied on during testing See the PRs leading up to this #6340 #6360 #6361 #6323 #6324 ## Screenshots of UI changes (or N/A) N/A
Motivation for features / changes
As part of the effort to bring hparams to the time series dashboard a handful of new selectors need to be created. Rather than further the practice of creating selectors with props (which is deprecated) I am choosing to create them using the recommended solution of a selector factory. Unfortunately selector factories don't play nicely with selectors dependent selectors WITH props. There are a handful of hacky solutions to this problem but I am opting to create new dependent selectors using the factory pattern.
Technical description of changes
I extracted the result functions from the existing selectors, then created new factories which call them with an additional closured parameter.
Screenshots of UI changes
None
Detailed steps to verify changes work correctly (as executed by you)
Tests should pass
Alternate designs / implementations considered
I could have just wrapped the existing selectors and then called them passing in the global state instead. I chose this approach instead with the hope of removing the old selectors in a later pr.