Skip to content

Commit e22814b

Browse files
committed
fix signatures
1 parent 87211f2 commit e22814b

File tree

4 files changed

+38
-27
lines changed

4 files changed

+38
-27
lines changed

api/specs/web-server/_storage.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
from typing import Annotated, TypeAlias
8-
from uuid import UUID
98

109
from fastapi import APIRouter, Depends, Query, status
10+
from models_library.api_schemas_rpc_async_jobs.async_jobs import AsyncJobId
1111
from models_library.api_schemas_storage.storage_schemas import (
1212
FileLocation,
1313
FileMetaDataGet,
@@ -210,15 +210,15 @@ async def export_data(data_export: DataExportPost, location_id: LocationID):
210210
response_model=Envelope[StorageAsyncJobStatus],
211211
name="get_async_job_status",
212212
)
213-
async def get_async_job_status(storage_async_job_get: StorageAsyncJobGet, job_id: UUID):
213+
async def get_async_job_status(job_id: AsyncJobId):
214214
"""Get async job status"""
215215

216216

217217
@router.post(
218218
"/storage/async-jobs/{job_id}:abort",
219219
name="abort_async_job",
220220
)
221-
async def abort_async_job(storage_async_job_get: StorageAsyncJobGet, job_id: UUID):
221+
async def abort_async_job(job_id: AsyncJobId):
222222
"""aborts execution of an async job"""
223223

224224

@@ -227,7 +227,7 @@ async def abort_async_job(storage_async_job_get: StorageAsyncJobGet, job_id: UUI
227227
response_model=Envelope[StorageAsyncJobResult],
228228
name="get_async_job_result",
229229
)
230-
async def get_async_job_result(storage_async_job_get: StorageAsyncJobGet, job_id: UUID):
230+
async def get_async_job_result(job_id: AsyncJobId):
231231
"""Get the result of the async job"""
232232

233233

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def from_job_id(cls, app: web.Application, job_id: str) -> "AsyncJobLinks":
6565
)
6666

6767

68+
class StorageAsyncJobId(InputSchema):
69+
job_id: AsyncJobId
70+
71+
6872
class StorageAsyncJobGet(OutputSchema):
6973
job_id: AsyncJobId
7074
links: AsyncJobLinks
@@ -73,10 +77,11 @@ class StorageAsyncJobGet(OutputSchema):
7377
def from_rpc_schema(
7478
cls, *, app: web.Application, async_job_rpc_get: AsyncJobGet
7579
) -> "StorageAsyncJobGet":
76-
job_id = f"{async_job_rpc_get.job_id}"
7780
return StorageAsyncJobGet(
7881
job_id=async_job_rpc_get.job_id,
79-
links=AsyncJobLinks.from_job_id(app=app, job_id=job_id),
82+
links=AsyncJobLinks.from_job_id(
83+
app=app, job_id=f"{async_job_rpc_get.job_id}"
84+
),
8085
)
8186

8287

services/web/server/src/simcore_service_webserver/api/v0/openapi.yaml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6427,12 +6427,6 @@ paths:
64276427
type: string
64286428
format: uuid
64296429
title: Job Id
6430-
requestBody:
6431-
required: true
6432-
content:
6433-
application/json:
6434-
schema:
6435-
$ref: '#/components/schemas/StorageAsyncJobGet'
64366430
responses:
64376431
'200':
64386432
description: Successful Response
@@ -6455,12 +6449,6 @@ paths:
64556449
type: string
64566450
format: uuid
64576451
title: Job Id
6458-
requestBody:
6459-
required: true
6460-
content:
6461-
application/json:
6462-
schema:
6463-
$ref: '#/components/schemas/StorageAsyncJobGet'
64646452
responses:
64656453
'200':
64666454
description: Successful Response
@@ -6482,12 +6470,6 @@ paths:
64826470
type: string
64836471
format: uuid
64846472
title: Job Id
6485-
requestBody:
6486-
required: true
6487-
content:
6488-
application/json:
6489-
schema:
6490-
$ref: '#/components/schemas/StorageAsyncJobGet'
64916473
responses:
64926474
'200':
64936475
description: Successful Response
@@ -7798,6 +7780,23 @@ components:
77987780
- app_name
77997781
- version
78007782
title: AppStatusCheck
7783+
AsyncJobLinks:
7784+
properties:
7785+
statusHref:
7786+
type: string
7787+
title: Statushref
7788+
abortHref:
7789+
type: string
7790+
title: Aborthref
7791+
resultHref:
7792+
type: string
7793+
title: Resulthref
7794+
type: object
7795+
required:
7796+
- statusHref
7797+
- abortHref
7798+
- resultHref
7799+
title: AsyncJobLinks
78017800
Author:
78027801
properties:
78037802
name:
@@ -14891,9 +14890,12 @@ components:
1489114890
type: string
1489214891
format: uuid
1489314892
title: Jobid
14893+
links:
14894+
$ref: '#/components/schemas/AsyncJobLinks'
1489414895
type: object
1489514896
required:
1489614897
- jobId
14898+
- links
1489714899
title: StorageAsyncJobGet
1489814900
StorageAsyncJobResult:
1489914901
properties:
@@ -14933,13 +14935,16 @@ components:
1493314935
format: date-time
1493414936
- type: 'null'
1493514937
title: Stopped
14938+
links:
14939+
$ref: '#/components/schemas/AsyncJobLinks'
1493614940
type: object
1493714941
required:
1493814942
- jobId
1493914943
- progress
1494014944
- done
1494114945
- started
1494214946
- stopped
14947+
- links
1494314948
title: StorageAsyncJobStatus
1494414949
Structure:
1494514950
properties:

services/web/server/src/simcore_service_webserver/storage/_rest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from models_library.api_schemas_webserver.storage import (
2121
DataExportPost,
2222
StorageAsyncJobGet,
23+
StorageAsyncJobId,
2324
StorageAsyncJobResult,
2425
StorageAsyncJobStatus,
2526
)
@@ -479,7 +480,7 @@ async def get_async_job_status(request: web.Request) -> web.Response:
479480
_req_ctx = RequestContext.model_validate(request)
480481
rabbitmq_rpc_client = get_rabbitmq_rpc_client(request.app)
481482

482-
async_job_get = parse_request_path_parameters_as(StorageAsyncJobGet, request)
483+
async_job_get = parse_request_path_parameters_as(StorageAsyncJobId, request)
483484
async_job_rpc_status = await get_status(
484485
rabbitmq_rpc_client=rabbitmq_rpc_client,
485486
rpc_namespace=STORAGE_RPC_NAMESPACE,
@@ -507,7 +508,7 @@ async def abort_async_job(request: web.Request) -> web.Response:
507508
_req_ctx = RequestContext.model_validate(request)
508509

509510
rabbitmq_rpc_client = get_rabbitmq_rpc_client(request.app)
510-
async_job_get = parse_request_path_parameters_as(StorageAsyncJobGet, request)
511+
async_job_get = parse_request_path_parameters_as(StorageAsyncJobId, request)
511512
async_job_rpc_abort = await abort(
512513
rabbitmq_rpc_client=rabbitmq_rpc_client,
513514
rpc_namespace=STORAGE_RPC_NAMESPACE,
@@ -536,7 +537,7 @@ async def get_async_job_result(request: web.Request) -> web.Response:
536537
_req_ctx = RequestContext.model_validate(request)
537538

538539
rabbitmq_rpc_client = get_rabbitmq_rpc_client(request.app)
539-
async_job_get = parse_request_path_parameters_as(StorageAsyncJobGet, request)
540+
async_job_get = parse_request_path_parameters_as(StorageAsyncJobId, request)
540541
async_job_rpc_result = await get_result(
541542
rabbitmq_rpc_client=rabbitmq_rpc_client,
542543
rpc_namespace=STORAGE_RPC_NAMESPACE,

0 commit comments

Comments
 (0)