Skip to content
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

Quality check timeout #228

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Collections/SearchQuality/SearchQuality.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { getSnackbarOptions } from '../../Common/utils/snackbarOptions';
import { useClient } from '../../../context/client-context';
import SearchQualityPannel from './SearchQualityPannel';
import SearchQualityPanel from './SearchQualityPanel';
import { useSnackbar } from 'notistack';
import { Box, Card, CardHeader } from '@mui/material';
import { CopyButton } from '../../Common/CopyButton';
Expand Down Expand Up @@ -51,7 +51,7 @@ const SearchQuality = ({ collectionName }) => {
return (
<>
{collection?.config?.params?.vectors && (
<SearchQualityPannel
<SearchQualityPanel
collectionName={collectionName}
vectors={vectors}
loggingFoo={handleLogUpdate}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ VectorTableRow.propTypes = {
isInProgress: PropTypes.bool,
};

const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo, ...other }) => {
const SearchQualityPanel = ({ collectionName, vectors, loggingFoo, clearLogsFoo, ...other }) => {
const { client } = useClient();
const vectorsNames = Object.keys(vectors);
const [precision, setPrecision] = useState(() => {
Expand Down Expand Up @@ -110,7 +110,8 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
// "value": "field_value"
// }
// }
// }
// },
// "timeout": 20
// }

`);
Expand Down Expand Up @@ -153,14 +154,21 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
},
],
},
timeout: {
description: 'Timeout for search',
type: 'integer',
format: 'uint',
minimum: 1,
nullable: true,
},
},
});

if (!vectors) {
return <>No vectors</>;
}

const onCheckIndexQuality = async ({ using = '', limit = 10, params = null, filter = null }) => {
const onCheckIndexQuality = async ({ using = '', limit = 10, params = null, filter = null, timeout }) => {
setInProgress(true);

clearLogsFoo && clearLogsFoo();
Expand Down Expand Up @@ -191,7 +199,8 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
filter,
params,
using,
limit
limit,
timeout
);
if (precision) {
precisions.push(precision);
Expand Down Expand Up @@ -311,12 +320,12 @@ const SearchQualityPannel = ({ collectionName, vectors, loggingFoo, clearLogsFoo
);
};

SearchQualityPannel.propTypes = {
SearchQualityPanel.propTypes = {
collectionName: PropTypes.string,
vectors: PropTypes.object.isRequired,
loggingFoo: PropTypes.func,
clearLogsFoo: PropTypes.func,
other: PropTypes.object,
};

export default SearchQualityPannel;
export default SearchQualityPanel;
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ export const checkIndexPrecision = async (
filter = null,
params = null,
vectorName = null,
limit = 10
limit = 10,
timeout = 20
) => {
const TIMEOUT = 20;

try {
const exactSearchtartTime = new Date().getTime();

Expand All @@ -25,15 +24,15 @@ export const checkIndexPrecision = async (
},
filter: filter,
using: vectorName,
timeout: TIMEOUT,
timeout,
});

const exactSearchElapsed = new Date().getTime() - exactSearchtartTime;

const searchStartTime = new Date().getTime();

const hnsw = await client.query(collectionName, {
timeout: TIMEOUT,
timeout,
limit: limit,
with_payload: false,
with_vectors: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/EditorCommon/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const EditorCommon = ({ beforeMount, customHeight, ...props }) => {
EditorCommon.propTypes = {
height: PropTypes.string,
beforeMount: PropTypes.func,
customHeight: PropTypes.number,
customHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
...Editor.propTypes,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/FilterEditorWindow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ CodeEditorWindow.propTypes = {
code: PropTypes.string.isRequired,
onChangeResult: PropTypes.func.isRequired,
customRequestSchema: PropTypes.func.isRequired,
customHeight: PropTypes.number,
customHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
};
export default CodeEditorWindow;
Loading