forked from pinks/eris
1
0
Fork 0

feat: show worker GPU

This commit is contained in:
nameless 2023-11-10 02:50:02 +00:00
parent f678324889
commit 556f1a4182
4 changed files with 29 additions and 3 deletions

View File

@ -55,6 +55,7 @@ async function getWorkerData(workerInstance: Model<WorkerInstance>): Promise<Wor
id: workerInstance.id,
key: workerInstance.value.key,
name: workerInstance.value.name,
gpu: workerInstance.value.gpu,
lastError: workerInstance.value.lastError,
lastOnlineTime: workerInstance.value.lastOnlineTime,
isActive: activeGenerationWorkers.get(workerInstance.id)?.isProcessing ?? false,

View File

@ -79,6 +79,27 @@ export async function processGenerationQueue() {
continue;
}
await workerSdClient.GET("/internal/sysinfo", {
params: {
query: {
attachment: false,
},
},
signal: AbortSignal.timeout(10_000),
})
.then((response) => {
if (!response.data) {
throw new SdError("Failed to get worker sysinfo", response.response, response.error);
}
// @ts-ignore there is no schema for /internal/sysinfo endpoint response
const nvidiaGPUModels = response.data["Torch env info"].nvidia_gpu_models ?? null;
if (nvidiaGPUModels !== null) {
workerInstance.update({ gpu: nvidiaGPUModels });
}
});
// create worker
const newWorker = generationQueue.createWorker(async ({ state }, updateJob) => {
await processGenerationJob(state, updateJob, workerInstance.id);

View File

@ -9,6 +9,7 @@ export const workerInstanceSchema = {
key: { type: "string" },
// used for display
name: { type: ["string", "null"] },
gpu: { type: ["string", "null"] },
sdUrl: { type: "string" },
sdAuth: {
type: ["object", "null"],

View File

@ -204,9 +204,12 @@ function WorkerListItem(props: {
return (
<li className="flex flex-col gap-2 rounded-md bg-zinc-100 dark:bg-zinc-800 p-2">
<p className="font-bold">
<div class="clearfix">
<span className="font-bold">
{worker.name ?? worker.key}
</p>
</span>
<span className="text-zinc-400 float-right">{worker.gpu}</span>
</div>
{worker.isActive ? <p> Active</p> : (
<>
<p>