Skip to content

Commit 94251bb

Browse files
authored
HParams: Only filter scalar card runs by hparams when enableHparamsInTimeSeries is true (#6399)
## Motivation for features / changes We have been discovering issues with the way the hparam domains are defined. This has lead to issues due to #6377 causing scalar cards to appear empty when one of these issues occurs. I attempted to fix this in #6393 but missed the situation where a string type hparam with more than 10 values returns an empty domain (Googlers see tb/3183400180427144287 for an example). I am moving the new filtering logic added in by #6377 behind a flag while we fix this issue on the backend. ## Screenshots of UI changes (or N/A) Screenshots for Googlers only Before: https://screenshot.googleplex.com/AELb2oHqhxa8UNF After: Feature Flag Enabled: https://screenshot.googleplex.com/AcPxsbNNXSSFGx9 Feature Flag Disabled: https://screenshot.googleplex.com/3aEXpfHrGZdzYgZ
1 parent d578440 commit 94251bb

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {
3838
import {State} from '../../../app_state';
3939
import {ExperimentAlias} from '../../../experiments/types';
4040
import {
41+
getEnableHparamsInTimeSeries,
4142
getForceSvgFeatureFlag,
4243
getIsScalarColumnCustomizationEnabled,
4344
} from '../../../feature_flag/store/feature_flag_selectors';
@@ -498,6 +499,7 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
498499
}),
499500
combineLatestWith(
500501
this.store.select(getCurrentRouteRunSelection),
502+
this.store.select(getEnableHparamsInTimeSeries),
501503
this.store.select(getFilteredRenderableRunsIdsFromRoute),
502504
this.store.select(getRunColorMap),
503505
this.store.select(getMetricsScalarSmoothing)
@@ -511,6 +513,7 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
511513
([
512514
namedPartitionedSeries,
513515
runSelectionMap,
516+
hparamsInTimeSeriesEnabled,
514517
renderableRuns,
515518
colorMap,
516519
smoothing,
@@ -539,7 +542,7 @@ export class ScalarCardContainer implements CardRenderer, OnInit, OnDestroy {
539542
visible: Boolean(
540543
runSelectionMap &&
541544
runSelectionMap.get(runId) &&
542-
renderableRuns.has(runId)
545+
(!hparamsInTimeSeriesEnabled || renderableRuns.has(runId))
543546
),
544547
color: colorMap[runId] ?? '#fff',
545548
aux: false,

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3631,6 +3631,73 @@ describe('scalar card', () => {
36313631
expect(data[5].run).toEqual('3 c/run6');
36323632
expect(data[6].run).toEqual('1 a/run7');
36333633
}));
3634+
3635+
describe('while integrated with hparams in timeseries', () => {
3636+
beforeEach(() => {
3637+
const runToSeries = {
3638+
run1: [{wallTime: 1, value: 1, step: 1}],
3639+
run2: [{wallTime: 1, value: 2, step: 1}],
3640+
run3: [{wallTime: 1, value: 3, step: 1}],
3641+
run4: [{wallTime: 1, value: NaN, step: 1}],
3642+
run5: [{wallTime: 1, value: 'NaN', step: 1}],
3643+
run6: [{wallTime: 1, value: null, step: 1}],
3644+
run7: [{wallTime: 1, value: undefined, step: 1}],
3645+
};
3646+
provideMockCardRunToSeriesData(
3647+
selectSpy,
3648+
PluginType.SCALARS,
3649+
'card1',
3650+
null /* metadataOverride */,
3651+
runToSeries as any
3652+
);
3653+
store.overrideSelector(
3654+
selectors.getCurrentRouteRunSelection,
3655+
new Map([
3656+
['run1', true],
3657+
['run2', true],
3658+
])
3659+
);
3660+
3661+
store.overrideSelector(
3662+
commonSelectors.getFilteredRenderableRunsIdsFromRoute,
3663+
new Set(['run1'])
3664+
);
3665+
3666+
store.overrideSelector(getMetricsLinkedTimeSelection, {
3667+
start: {step: 1},
3668+
end: null,
3669+
});
3670+
});
3671+
3672+
it('filters runs by hparam when enableHparamsInTimeSeries is true', fakeAsync(() => {
3673+
store.overrideSelector(selectors.getEnableHparamsInTimeSeries, true);
3674+
3675+
const fixture = createComponent('card1');
3676+
const scalarCardDataTable = fixture.debugElement.query(
3677+
By.directive(ScalarCardDataTable)
3678+
);
3679+
3680+
const data =
3681+
scalarCardDataTable.componentInstance.getTimeSelectionTableData();
3682+
expect(data.length).toEqual(1);
3683+
expect(data[0].run).toEqual('run1');
3684+
}));
3685+
3686+
it('does not filter runs by hparam when enableHparamsInTimeSeries is false', fakeAsync(() => {
3687+
store.overrideSelector(selectors.getEnableHparamsInTimeSeries, false);
3688+
3689+
const fixture = createComponent('card1');
3690+
const scalarCardDataTable = fixture.debugElement.query(
3691+
By.directive(ScalarCardDataTable)
3692+
);
3693+
3694+
const data =
3695+
scalarCardDataTable.componentInstance.getTimeSelectionTableData();
3696+
expect(data.length).toEqual(2);
3697+
expect(data[0].run).toEqual('run1');
3698+
expect(data[1].run).toEqual('run2');
3699+
}));
3700+
});
36343701
});
36353702

36363703
describe('toggleTableExpanded', () => {

0 commit comments

Comments
 (0)