Spaces:
Running
Running
Expose monotonic generation progress update boundary
Browse files
app/generation/services/generation_service.py
CHANGED
|
@@ -375,6 +375,22 @@ class GenerationService:
|
|
| 375 |
product_surface=original_request.product_surface,
|
| 376 |
)
|
| 377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 378 |
async def list_job_attempts(
|
| 379 |
self, workspace_id: str, user_id: str, job_id: str
|
| 380 |
) -> list[GenerationJobAttemptView]:
|
|
|
|
| 375 |
product_surface=original_request.product_surface,
|
| 376 |
)
|
| 377 |
|
| 378 |
+
async def update_progress(
|
| 379 |
+
self,
|
| 380 |
+
workspace_id: str,
|
| 381 |
+
user_id: str,
|
| 382 |
+
job_id: str,
|
| 383 |
+
progress_percent: int,
|
| 384 |
+
) -> GenerationJobView:
|
| 385 |
+
self.ensure_ready()
|
| 386 |
+
job = await self.repository.update_progress(
|
| 387 |
+
workspace_id,
|
| 388 |
+
job_id,
|
| 389 |
+
user_id=user_id,
|
| 390 |
+
progress_percent=progress_percent,
|
| 391 |
+
)
|
| 392 |
+
return GenerationJobView.from_record(job)
|
| 393 |
+
|
| 394 |
async def list_job_attempts(
|
| 395 |
self, workspace_id: str, user_id: str, job_id: str
|
| 396 |
) -> list[GenerationJobAttemptView]:
|