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

fix: various fixes #162

Merged
merged 3 commits into from
Sep 26, 2023
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
2 changes: 1 addition & 1 deletion web/src/components/Bid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const BidCard: React.FC<BidCardProps> = ({ bid, ...props }) => {
const handleOpen = () => navigate(`/provider/${provider?.provider?.owner}`);

if (loadingProvider || loadingAttributes) {
return <CircularProgress />;
return <></>;
}

if (hideIfNotAudited && !attributes?.providers?.length) {
Expand Down
41 changes: 28 additions & 13 deletions web/src/components/SdlConfiguration/Gpu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,41 @@ const GpuAttributes: React.FC<GpuAttributesProps> = ({ currentProfile, disabled
const attributes = values.sdl.profiles.compute[currentProfile].resources.gpu.attributes || {};
const { data: gpus, isLoading: loadingGpus } = useQuery(['gpus', 'all'], queryProviderGpus);

const getModels = (attributes: GpuAttributes, vendor: string) => {
if (vendor !== 'nvidia' && vendor !== 'amd' && vendor !== 'intel') {
return new Set();
}
const addGpuFilter = (model: string, vendor: string) => {
const vendorModels: Array<{ model: string }> = attributes?.vendor[vendor] || [];
const modelSet = new Set(vendorModels.map((m) => `${m.model}`));

return new Set(attributes?.vendor[vendor]?.models);
};
modelSet.add(model);

const updateAttributeModels = (attributes: GpuAttributes, vendor: string, models: Set<string>) => {
return null;
const updatedModels = Array.from(modelSet).map((m) => ({ model: m }));
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu.attributes.vendor.${vendor}`, updatedModels);
};

const addGpuFilter = (model: string, vendor: string) => {
attributes.vendor[vendor].models = [...attributes.vendor[vendor].models, model];
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu.attributes`, attributes);
const removeGpuVendor = (model: string, vendor: string) => {
const vendorSet = new Set(Object.keys(attributes.vendor));

vendorSet.delete(vendor);

if (vendorSet.size === 0) {
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu`, undefined);
} else {
const updatedVendors = Array.from(vendorSet).map((v) => ({ [v]: attributes.vendor[v] }));
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu.attributes.vendor`, updatedVendors);
}
};

const removeGpuFilter = (model: string, vendor: string) => {
attributes.vendor[vendor].models = attributes.vendor[vendor].models.filter((m: string) => m !== model);
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu.attributes`, attributes);
const vendorModels: Array<{ model: string }> = attributes?.vendor[vendor] || [];
const modelSet = new Set(vendorModels.map((m) => `${m.model}`));

modelSet.delete(model);

if (modelSet.size === 0) {
removeGpuVendor(model, vendor);
} else {
const updatedModels = Array.from(modelSet).map((m) => ({ model: m }));
setFieldValue(`sdl.profiles.compute.${currentProfile}.resources.gpu.attributes.vendor.${vendor}`, updatedModels);
}
};

const handleGpuClick = (vendor: string, model: string) => {
Expand Down
4 changes: 3 additions & 1 deletion web/src/hooks/useDeploymentData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ export default function useDeploymentData(owner: string) {

if (leaseStatus && leaseStatus.services) {
url = Object.values(leaseStatus.services)
.map((service) => (service as any).uris[0])
.map((service) => (service as any).uris)
.filter((uri) => uri && uri[0])
.map((uri) => uri[0])
.join(', ');
}
}
Expand Down
Loading