Skip to content

Commit

Permalink
Endpoint Interruption Logic for Model Overview with OD (microsoft#2268)
Browse files Browse the repository at this point in the history
* endpoint interruption working ckpt

* auto lint fixes
  • Loading branch information
Advitya17 authored Aug 24, 2023
1 parent a714c25 commit 798e9d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ interface IModelOverviewState {
featureBasedCohortLabeledStatistics: ILabeledStatistic[][];
featureBasedCohorts: ErrorCohort[];
iouThreshold: number;
objectDetectionAbortController: AbortController | undefined;
}

const datasetCohortViewPivotKey = "datasetCohortView";
Expand Down Expand Up @@ -125,6 +126,7 @@ export class ModelOverview extends React.Component<
featureConfigurationIsVisible: false,
iouThreshold: 70,
metricConfigurationIsVisible: false,
objectDetectionAbortController: undefined,
selectedFeatures: [],
selectedFeaturesContinuousFeatureBins: {},
selectedMetrics: [],
Expand Down Expand Up @@ -362,6 +364,7 @@ export class ModelOverview extends React.Component<
setIoUThreshold={this.setIoUThreshold}
updateDatasetCohortStats={this.updateDatasetCohortStats}
updateFeatureCohortStats={this.updateFeatureCohortStats}
abortController={this.state.objectDetectionAbortController}
/>
)}
</Stack>
Expand Down Expand Up @@ -650,14 +653,16 @@ export class ModelOverview extends React.Component<
this.state.className.length > 0 &&
this.state.iouThreshold
) {
const newAbortController = new AbortController();
this.setState({ objectDetectionAbortController: newAbortController });
this.context
.requestObjectDetectionMetrics(
selectionIndexes,
this.state.aggregateMethod,
this.state.className,
this.state.iouThreshold,
this.objectDetectionCache,
new AbortController().signal
newAbortController.signal
)
.then((result) => {
const [allCohortMetrics, cohortClasses] = result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export interface IObjectDetectionWidgetsProps {
setIoUThreshold: (value: number) => void;
updateDatasetCohortStats: () => void;
updateFeatureCohortStats: () => Promise<void>;
abortController: AbortController | undefined;
telemetryHook?: (message: ITelemetryEvent) => void;
}

Expand Down Expand Up @@ -115,11 +116,18 @@ export class ObjectDetectionWidgets extends React.PureComponent<IObjectDetection
);
}

private abortAnyPreexistingExecution(): void {
if (this.props.abortController !== undefined) {
this.props.abortController.abort();
}
}

private onAggregateMethodChange = (
_: React.FormEvent<IComboBox>,
item?: IComboBoxOption
): void => {
if (item) {
this.abortAnyPreexistingExecution();
this.props.setAggregateMethod(item.text.toString());
}
};
Expand All @@ -129,12 +137,14 @@ export class ObjectDetectionWidgets extends React.PureComponent<IObjectDetection
item?: IComboBoxOption
): void => {
if (item) {
this.abortAnyPreexistingExecution();
this.props.setClassName(item.text.toString());
}
};

private onIoUThresholdChange = (_: React.MouseEvent, value: number): void => {
if (value) {
this.abortAnyPreexistingExecution();
this.props.setIoUThreshold(value);
}
};
Expand Down

0 comments on commit 798e9d5

Please sign in to comment.