Spaces:
Sleeping
Sleeping
Download src/models/worker.model.ts from sardarbipul/test: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/sardarbipul/test/resolve/main/src/models/worker.model.ts
- Command line
-
hf download hf://spaces/sardarbipul/test/src/models/worker.model.ts
-
curl -L -o worker.model.ts https://huggingface.co/spaces/sardarbipul/test/resolve/main/src/models/worker.model.ts
1.49 kB
| import { IWorker, WorkerPlatform, WorkerStatus } from '../types/worker.types'; | |
| export class WorkerModel implements IWorker { | |
| public workerId: string; | |
| public workerName: string; | |
| public platform: WorkerPlatform; | |
| public cpu: string; | |
| public ram: string; | |
| public gpu: string; | |
| public tpu: string; | |
| public batchSize: number; | |
| public rowsPerSecond: number; | |
| public lastHeartbeat: string; | |
| public currentTaskId: string | null; | |
| public status: WorkerStatus; | |
| public tasksCompleted: number; | |
| public tasksFailed: number; | |
| public totalRowsProcessed: number; | |
| public connectedAt: string; | |
| constructor(data: Partial<IWorker> & { workerId: string; workerName: string; platform: WorkerPlatform }) { | |
| const now = new Date().toISOString(); | |
| this.workerId = data.workerId; | |
| this.workerName = data.workerName; | |
| this.platform = data.platform; | |
| this.cpu = String(data.cpu || 'Unknown'); | |
| this.ram = String(data.ram || 'Unknown'); | |
| this.gpu = String(data.gpu || 'None'); | |
| this.tpu = String(data.tpu || 'None'); | |
| this.batchSize = data.batchSize || 32; | |
| this.rowsPerSecond = data.rowsPerSecond || 0; | |
| this.lastHeartbeat = data.lastHeartbeat || now; | |
| this.currentTaskId = data.currentTaskId || null; | |
| this.status = data.status || 'idle'; | |
| this.tasksCompleted = data.tasksCompleted || 0; | |
| this.tasksFailed = data.tasksFailed || 0; | |
| this.totalRowsProcessed = data.totalRowsProcessed || 0; | |
| this.connectedAt = data.connectedAt || now; | |
| } | |
| } | |