Skip to content

Commit

Permalink
Revert "feat: exclude remote model for admin UI (opensearch-project#225
Browse files Browse the repository at this point in the history
…)"

This reverts commit ba01d34.
  • Loading branch information
wanglam committed Aug 2, 2023
1 parent 02e80a9 commit 049ab05
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 23 deletions.
1 change: 0 additions & 1 deletion public/apis/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class Model {
size: number;
states?: MODEL_STATE[];
nameOrId?: string;
exclude?: 'REMOTE_MODEL';
}) {
return InnerHttpProvider.getHttp().get<ModelSearchResponse>(MODEL_API_ENDPOINT, {
query,
Expand Down
1 change: 0 additions & 1 deletion public/components/monitoring/use_monitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const fetchDeployedModels = async (params: Params) => {
? [MODEL_STATE.loadFailed, MODEL_STATE.loaded, MODEL_STATE.partiallyLoaded]
: states,
sort: [`${params.sort.field}-${params.sort.direction}`],
exclude: 'REMOTE_MODEL',
});
const totalPages = Math.ceil(result.total_models / params.pageSize);
return {
Expand Down
4 changes: 1 addition & 3 deletions server/routes/model_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ export const modelRouter = (router: IRouter) => {
),
states: schema.maybe(schema.oneOf([schema.arrayOf(modelStateSchema), modelStateSchema])),
nameOrId: schema.maybe(schema.string()),
exclude: schema.maybe(schema.literal('REMOTE_MODEL')),
}),
},
},
async (context, request) => {
const { from, size, sort, states, nameOrId, exclude } = request.query;
const { from, size, sort, states, nameOrId } = request.query;
try {
const payload = await ModelService.search({
client: context.core.opensearch.client,
Expand All @@ -56,7 +55,6 @@ export const modelRouter = (router: IRouter) => {
sort: typeof sort === 'string' ? [sort] : sort,
states: typeof states === 'string' ? [states] : states,
nameOrId,
exclude,
});
return opensearchDashboardsResponseFactory.ok({ body: payload });
} catch (err) {
Expand Down
1 change: 0 additions & 1 deletion server/services/model_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class ModelService {
sort?: ModelSearchSort[];
states?: MODEL_STATE[];
nameOrId?: string;
exclude?: 'REMOTE_MODEL';
}) {
const {
body: { hits },
Expand Down
21 changes: 4 additions & 17 deletions server/services/utils/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import { generateTermQuery } from './query';
export const generateModelSearchQuery = ({
states,
nameOrId,
exclude,
}: {
states?: MODEL_STATE[];
nameOrId?: string;
exclude?: 'REMOTE_MODEL';
}) => ({
bool: {
must: [
Expand All @@ -35,21 +33,10 @@ export const generateModelSearchQuery = ({
]
: []),
],
must_not: [
{
exists: {
field: 'chunk_number',
},
must_not: {
exists: {
field: 'chunk_number',
},
...(exclude === 'REMOTE_MODEL'
? [
{
term: {
algorithm: 'REMOTE',
},
},
]
: []),
],
},
},
});

0 comments on commit 049ab05

Please sign in to comment.