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

Support num gpu filter #2680

Merged
merged 3 commits into from
May 13, 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
3 changes: 3 additions & 0 deletions packages/gridproxy_client/src/builders/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export interface NodesQuery {
healthy: boolean;
sortBy: SortBy;
sortOrder: SortOrder;
numGpu: number;
}

const NODES_MAPPER: BuilderMapper<NodesQuery> = {
Expand Down Expand Up @@ -114,6 +115,7 @@ const NODES_MAPPER: BuilderMapper<NodesQuery> = {
healthy: "healthy",
sortBy: "sort_by",
sortOrder: "sort_order",
numGpu: "num_gpu",
};

const NODES_VALIDATOR: BuilderValidator<NodesQuery> = {
Expand Down Expand Up @@ -165,6 +167,7 @@ const NODES_VALIDATOR: BuilderValidator<NodesQuery> = {
healthy: assertBoolean,
sortBy: assertString,
sortOrder: assertString,
numGpu: assertInt,
};

export class NodesBuilder extends AbstractBuilder<NodesQuery> {
Expand Down
24 changes: 24 additions & 0 deletions packages/playground/src/views/nodes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,28 @@
</template>
</TfFilter>

<TfFilter
query-route="num-gpu"
v-model="filters.numGpu"
:rules="[
validators.isNumeric('This field accepts numbers only.'),
validators.min('The number of gpus should be larger than zero.', 1),
validators.validateResourceMaxNumber('This value is out of range.'),
]"
>
<template #input="{ props }">
<VTextField density="compact" label="Num GPU" variant="outlined" v-model="filters.numGpu" v-bind="props">
<template #append-inner>
<VTooltip text="Filter by the number of gpus in the node.">
<template #activator="{ props }">
<VIcon icon="mdi-information-outline" v-bind="props" />
</template>
</VTooltip>
</template>
</VTextField>
</template>
</TfFilter>

<TfFilter
query-route="min-ssd"
v-model="filters.minSSD"
Expand Down Expand Up @@ -460,6 +482,7 @@ export default {
gpu: false,
publicIPs: "",
dedicated: false,
numGpu: "",
rentable: false,
});

Expand Down Expand Up @@ -507,6 +530,7 @@ export default {
dedicated: filters.value.dedicated || undefined,
sortBy: SortBy.Status,
sortOrder: SortOrder.Asc,
numGpu: +filters.value.numGpu || undefined,
rentable: filters.value.rentable && profileManager.profile ? filters.value.rentable : undefined,
availableFor: filters.value.rentable && profileManager.profile ? profileManager.profile.twinId : undefined,
},
Expand Down
Loading