Skip to content

Commit

Permalink
Merge pull request #2680 from threefoldtech/development_support_num_g…
Browse files Browse the repository at this point in the history
…pu_filter

Support num gpu filter
  • Loading branch information
amiraabouhadid authored May 13, 2024
2 parents a11a892 + ca6ca22 commit 4364940
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
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

0 comments on commit 4364940

Please sign in to comment.