Spaces:
Sleeping
Sleeping
Download src/services/implementations/progress.service.ts from sardarbipul/test: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/spaces/sardarbipul/test/resolve/main/src/services/implementations/progress.service.ts
- Command line
-
hf download hf://spaces/sardarbipul/test/src/services/implementations/progress.service.ts
-
curl -L -o progress.service.ts https://huggingface.co/spaces/sardarbipul/test/resolve/main/src/services/implementations/progress.service.ts
901 Bytes
| import { IProgressService } from '../interfaces/IProgressService'; | |
| import { ITaskQueueService } from '../interfaces/ITaskQueueService'; | |
| import { IWorkerService } from '../interfaces/IWorkerService'; | |
| export class ProgressService implements IProgressService { | |
| private taskQueueService: ITaskQueueService; | |
| private workerService: IWorkerService; | |
| constructor(taskQueueService: ITaskQueueService, workerService: IWorkerService) { | |
| this.taskQueueService = taskQueueService; | |
| this.workerService = workerService; | |
| } | |
| public async recordProgress( | |
| workerId: string, | |
| taskId: string, | |
| progress: number, | |
| rowsProcessed?: number, | |
| currentSpeed?: number | |
| ): Promise<void> { | |
| await Promise.all([ | |
| this.taskQueueService.updateTaskProgress(taskId, progress, rowsProcessed), | |
| this.workerService.recordHeartbeat(workerId, taskId, rowsProcessed, currentSpeed), | |
| ]); | |
| } | |
| } | |