From 798e9d5eb12c35d72aedea0f604753543c26f702 Mon Sep 17 00:00:00 2001 From: Advitya Gemawat Date: Thu, 24 Aug 2023 12:06:09 -0400 Subject: [PATCH] Endpoint Interruption Logic for Model Overview with OD (#2268) * endpoint interruption working ckpt * auto lint fixes --- .../Controls/ModelOverview/ModelOverview.tsx | 7 ++++++- .../ModelOverview/ObjectDetectionModelOverview.tsx | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ModelOverview.tsx b/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ModelOverview.tsx index cdb8c54aa3..33f6149827 100644 --- a/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ModelOverview.tsx +++ b/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ModelOverview.tsx @@ -88,6 +88,7 @@ interface IModelOverviewState { featureBasedCohortLabeledStatistics: ILabeledStatistic[][]; featureBasedCohorts: ErrorCohort[]; iouThreshold: number; + objectDetectionAbortController: AbortController | undefined; } const datasetCohortViewPivotKey = "datasetCohortView"; @@ -125,6 +126,7 @@ export class ModelOverview extends React.Component< featureConfigurationIsVisible: false, iouThreshold: 70, metricConfigurationIsVisible: false, + objectDetectionAbortController: undefined, selectedFeatures: [], selectedFeaturesContinuousFeatureBins: {}, selectedMetrics: [], @@ -362,6 +364,7 @@ export class ModelOverview extends React.Component< setIoUThreshold={this.setIoUThreshold} updateDatasetCohortStats={this.updateDatasetCohortStats} updateFeatureCohortStats={this.updateFeatureCohortStats} + abortController={this.state.objectDetectionAbortController} /> )} @@ -650,6 +653,8 @@ 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, @@ -657,7 +662,7 @@ export class ModelOverview extends React.Component< this.state.className, this.state.iouThreshold, this.objectDetectionCache, - new AbortController().signal + newAbortController.signal ) .then((result) => { const [allCohortMetrics, cohortClasses] = result; diff --git a/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ObjectDetectionModelOverview.tsx b/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ObjectDetectionModelOverview.tsx index a6d1a73e3b..1cdcdd349c 100644 --- a/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ObjectDetectionModelOverview.tsx +++ b/libs/model-assessment/src/lib/ModelAssessmentDashboard/Controls/ModelOverview/ObjectDetectionModelOverview.tsx @@ -55,6 +55,7 @@ export interface IObjectDetectionWidgetsProps { setIoUThreshold: (value: number) => void; updateDatasetCohortStats: () => void; updateFeatureCohortStats: () => Promise; + abortController: AbortController | undefined; telemetryHook?: (message: ITelemetryEvent) => void; } @@ -115,11 +116,18 @@ export class ObjectDetectionWidgets extends React.PureComponent, item?: IComboBoxOption ): void => { if (item) { + this.abortAnyPreexistingExecution(); this.props.setAggregateMethod(item.text.toString()); } }; @@ -129,12 +137,14 @@ export class ObjectDetectionWidgets extends React.PureComponent { 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); } };