Skip to content

Commit da812d2

Browse files
authored
Hparams: Allow users to load more Hparams if they are not all included in default. (#6780)
In #6777 we limited the number of hparams we load by default. Now we add the option for the user to load all hparams in spite of the performance implications. OSS Light Mode: ![image](https://github.com/tensorflow/tensorboard/assets/17152369/891856ac-bbf7-4b8b-be94-b776fe4bbe1e) OSS Dark Mode: ![image](https://github.com/tensorflow/tensorboard/assets/17152369/7f6fff68-73c2-4321-8912-8deb651be83d) Internal Light Mode: ![image](https://github.com/tensorflow/tensorboard/assets/17152369/b0e251c2-6b07-45e6-948d-bce24923d75a) Internal Dark Mode: ![image](https://github.com/tensorflow/tensorboard/assets/17152369/d8959cd1-d12c-401e-9a75-45eae5fa4551)
1 parent 571a6a6 commit da812d2

20 files changed

+132
-45
lines changed

tensorboard/webapp/hparams/_redux/hparams_actions.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,7 @@ export const dashboardHparamColumnOrderChanged = createAction(
7171
'[Hparams] Dashboard Hparam Column Order Changed',
7272
props<ReorderColumnEvent>()
7373
);
74+
75+
export const loadAllDashboardHparams = createAction(
76+
'[Hparams] Load all Hparams'
77+
);

tensorboard/webapp/hparams/_redux/hparams_effects.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export class HparamsEffects {
6262

6363
private readonly loadHparamsOnReload$: Observable<string[]> =
6464
this.actions$.pipe(
65-
ofType(coreActions.reload, coreActions.manualReload),
65+
ofType(
66+
coreActions.reload,
67+
coreActions.manualReload,
68+
hparamsActions.loadAllDashboardHparams
69+
),
6670
withLatestFrom(this.store.select(getExperimentIdsFromRoute)),
6771
filter(([, experimentIds]) => Boolean(experimentIds)),
6872
map(([, experimentIds]) => experimentIds as string[])

tensorboard/webapp/hparams/_redux/hparams_effects_test.ts

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ describe('hparams effects', () => {
101101
dataSource.fetchSessionGroups.and.returnValue(of(mockSessionGroups));
102102
});
103103

104+
afterEach(() => {
105+
store?.resetSelectors();
106+
});
107+
104108
describe('loadHparamsData$', () => {
105109
beforeEach(() => {
106110
effects.loadHparamsData$.subscribe((action) => {
@@ -162,41 +166,32 @@ describe('hparams effects', () => {
162166
]);
163167
});
164168

165-
it('fetches data on reload', () => {
166-
action.next(coreActions.reload());
167-
expect(dataSource.fetchExperimentInfo).toHaveBeenCalledWith(
168-
['expFromRoute'],
169-
1111
170-
);
171-
expect(dataSource.fetchSessionGroups).toHaveBeenCalledWith(
172-
['expFromRoute'],
173-
[buildHparamSpec({name: 'h1'})]
174-
);
175-
expect(actualActions).toEqual([
176-
hparamsActions.hparamsFetchSessionGroupsSucceeded({
177-
hparamSpecs: mockHparamSpecs,
178-
sessionGroups: mockSessionGroups,
179-
}),
180-
]);
181-
});
182-
183-
it('fetches data on manualReload', () => {
184-
action.next(coreActions.manualReload());
185-
expect(dataSource.fetchExperimentInfo).toHaveBeenCalledWith(
186-
['expFromRoute'],
187-
1111
188-
);
189-
expect(dataSource.fetchSessionGroups).toHaveBeenCalledWith(
190-
['expFromRoute'],
191-
[buildHparamSpec({name: 'h1'})]
192-
);
193-
expect(actualActions).toEqual([
194-
hparamsActions.hparamsFetchSessionGroupsSucceeded({
195-
hparamSpecs: mockHparamSpecs,
196-
sessionGroups: mockSessionGroups,
197-
}),
198-
]);
199-
});
169+
for (const {actionName, actionInstance} of [
170+
{actionName: 'reload', actionInstance: coreActions.reload()},
171+
{actionName: 'manualReload', actionInstance: coreActions.manualReload()},
172+
{
173+
actionName: 'loadAllDashboardHparams',
174+
actionInstance: hparamsActions.loadAllDashboardHparams(),
175+
},
176+
]) {
177+
it(`fetches data on ${actionName}`, () => {
178+
action.next(actionInstance);
179+
expect(dataSource.fetchExperimentInfo).toHaveBeenCalledWith(
180+
['expFromRoute'],
181+
1111
182+
);
183+
expect(dataSource.fetchSessionGroups).toHaveBeenCalledWith(
184+
['expFromRoute'],
185+
[buildHparamSpec({name: 'h1'})]
186+
);
187+
expect(actualActions).toEqual([
188+
hparamsActions.hparamsFetchSessionGroupsSucceeded({
189+
hparamSpecs: mockHparamSpecs,
190+
sessionGroups: mockSessionGroups,
191+
}),
192+
]);
193+
});
194+
}
200195

201196
it('does not attempt to load hparams when experiment ids are null', () => {
202197
store.overrideSelector(selectors.getExperimentIdsFromRoute, null);

tensorboard/webapp/hparams/_redux/hparams_reducers.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,13 @@ const reducer: ActionReducer<HparamsState, Action> = createReducer(
166166
dashboardDisplayedHparamColumns: newColumns,
167167
};
168168
}
169-
)
169+
),
170+
on(actions.loadAllDashboardHparams, (state) => {
171+
return {
172+
...state,
173+
numDashboardHparamsToLoad: 0, // All.
174+
};
175+
})
170176
);
171177

172178
export function reducers(state: HparamsState | undefined, action: Action) {

tensorboard/webapp/hparams/_redux/hparams_reducers_test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,4 +712,16 @@ describe('hparams/_redux/hparams_reducers_test', () => {
712712
]);
713713
});
714714
});
715+
716+
describe('loadAllDashboardHparams', () => {
717+
it('sets numDashboardHparamsToLoad to 0', () => {
718+
const state = buildHparamsState({
719+
numDashboardHparamsToLoad: 1000,
720+
});
721+
722+
const state2 = reducers(state, actions.loadAllDashboardHparams());
723+
724+
expect(state2.numDashboardHparamsToLoad).toEqual(0);
725+
});
726+
});
715727
});

tensorboard/webapp/hparams/_redux/hparams_selectors_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ limitations under the License.
1515

1616
import {ColumnHeaderType} from '../../widgets/data_table/types';
1717
import {DomainType} from '../types';
18-
import {State} from './types';
1918
import * as selectors from './hparams_selectors';
2019
import {
2120
buildHparamSpec,

tensorboard/webapp/metrics/views/card_renderer/scalar_card_component.ng.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@
211211
(removeColumn)="removeColumn.emit($event)"
212212
(hideColumn)="hideColumn.emit($event)"
213213
(addFilter)="addFilter.emit($event)"
214+
(loadAllColumns)="loadAllColumns.emit()"
214215
>
215216
</scalar-card-data-table>
216217
</div>

tensorboard/webapp/metrics/views/card_renderer/scalar_card_component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ export class ScalarCardComponent<Downloader> {
132132
@Output() addColumn = new EventEmitter<AddColumnEvent>();
133133
@Output() removeColumn = new EventEmitter<HeaderToggleInfo>();
134134
@Output() addFilter = new EventEmitter<FilterAddedEvent>();
135+
@Output() loadAllColumns = new EventEmitter<null>();
135136

136137
@Output() onLineChartZoom = new EventEmitter<Extent | null>();
137138
@Output() onCardStateChanged = new EventEmitter<Partial<CardState>>();

tensorboard/webapp/metrics/views/card_renderer/scalar_card_container.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ function areSeriesEqual(
211211
(addColumn)="onAddColumn($event)"
212212
(removeColumn)="onRemoveColumn($event)"
213213
(addFilter)="addHparamFilter($event)"
214+
(loadAllColumns)="loadAllColumns()"
214215
></scalar-card-component>
215216
`,
216217
styles: [
@@ -763,4 +764,8 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
763764
})
764765
);
765766
}
767+
768+
loadAllColumns() {
769+
this.store.dispatch(hparamsActions.loadAllDashboardHparams());
770+
}
766771
}

tensorboard/webapp/metrics/views/card_renderer/scalar_card_data_table.ng.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
(addColumn)="addColumn.emit($event)"
2828
(removeColumn)="onRemoveColumn($event)"
2929
(addFilter)="addFilter.emit($event)"
30+
(loadAllColumns)="loadAllColumns.emit()"
3031
>
3132
<ng-container header>
3233
<ng-container *ngFor="let header of getHeaders()">

0 commit comments

Comments
 (0)