Skip to content

Commit 400a6c1

Browse files
committed
use ProgressReport
1 parent fd777ab commit 400a6c1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

packages/models-library/src/models_library/api_schemas_rpc_async_jobs/async_jobs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
from uuid import UUID
44

55
from pydantic import BaseModel, model_validator
6-
from servicelib.progress_bar import ProgressBarData
76
from typing_extensions import Self
87

8+
from ..progress_bar import ProgressReport
9+
910
AsyncJobId: TypeAlias = UUID
1011

1112

1213
class AsyncJobStatus(BaseModel):
1314
job_id: AsyncJobId
14-
progress: ProgressBarData
15+
progress: ProgressReport
1516
done: bool
1617
started: datetime
1718
stopped: datetime | None

packages/models-library/src/models_library/api_schemas_webserver/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
AsyncJobId,
1010
AsyncJobResult,
1111
AsyncJobStatus,
12-
ProgressBarData,
1312
)
1413
from ..api_schemas_storage.data_export_async_jobs import DataExportTaskStartInput
14+
from ..progress_bar import ProgressReport
1515
from ..projects_nodes_io import LocationID
1616
from ..users import UserID
1717

@@ -39,7 +39,7 @@ def from_async_job_rpc_get(
3939

4040
class StorageAsyncJobStatus(BaseModel):
4141
job_id: AsyncJobId
42-
progress: ProgressBarData
42+
progress: ProgressReport
4343
done: bool
4444
started: datetime
4545
stopped: datetime | None

services/storage/src/simcore_service_storage/api/rpc/_async_jobs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
ResultError,
1212
StatusError,
1313
)
14+
from models_library.progress_bar import ProgressReport
1415
from servicelib.rabbitmq import RPCRouter
1516

1617
router = RPCRouter()
@@ -25,9 +26,10 @@ async def abort(app: FastAPI, job_id: AsyncJobId) -> AsyncJobAbort:
2526
@router.expose(reraise_if_error_type=(StatusError,))
2627
async def get_status(app: FastAPI, job_id: AsyncJobId) -> AsyncJobStatus:
2728
assert app # nosec
29+
progress_report = ProgressReport(actual_value=0.5, total=1.0, attempt=1)
2830
return AsyncJobStatus(
2931
job_id=job_id,
30-
progress=0.5,
32+
progress=progress_report,
3133
done=False,
3234
started=datetime.now(),
3335
stopped=None,

0 commit comments

Comments
 (0)