feat: show worker GPU
This commit is contained in:
parent
f678324889
commit
556f1a4182
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue