Skip to content

Commit a25276c

Browse files
author
Andrei Neagu
committed
refactor
1 parent 27e9872 commit a25276c

File tree

7 files changed

+20
-13
lines changed

7 files changed

+20
-13
lines changed

services/dynamic-scheduler/src/simcore_service_dynamic_scheduler/services/service_tracker/_models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ def set_last_status_notification_to_now(self) -> None:
131131
#####################
132132

133133
def to_bytes(self) -> bytes:
134-
result: bytes = umsgpack.packb(self.dict(), ext_handlers=_PACKB_EXTENSION_TYPES)
134+
result: bytes = umsgpack.packb(
135+
self.model_dump(), ext_handlers=_PACKB_EXTENSION_TYPES
136+
)
135137
return result
136138

137139
@classmethod

services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/api/rest/health.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async def health_endpoint(
2929
) -> ApplicationHealth:
3030
if not application_health.is_healthy:
3131
raise HTTPException(
32-
status.HTTP_503_SERVICE_UNAVAILABLE, detail=application_health.dict()
32+
status.HTTP_503_SERVICE_UNAVAILABLE, detail=application_health.model_dump()
3333
)
3434

3535
if not rabbitmq_client.healthy or not rabbitmq_rpc_server.healthy:

services/dynamic-sidecar/tests/unit/test_api_rest_containers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def _start_containers(
104104

105105
response = await test_client.post(
106106
f"/{API_VTAG}/containers",
107-
json={"metrics_params": mock_metrics_params.dict()},
107+
json={"metrics_params": mock_metrics_params.model_dump()},
108108
)
109109
assert response.status_code == status.HTTP_202_ACCEPTED, response.text
110110
task_id: TaskId = response.json()

services/dynamic-sidecar/tests/unit/test_api_rest_containers_long_running_tasks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,16 @@ async def _get_task_id_create_service_containers(
290290
*args,
291291
**kwargs,
292292
) -> TaskId:
293-
ctontainers_compose_spec = ContainersComposeSpec(
293+
containers_compose_spec = ContainersComposeSpec(
294294
docker_compose_yaml=compose_spec,
295295
)
296296
await httpx_async_client.post(
297-
f"/{API_VTAG}/containers/compose-spec", json=ctontainers_compose_spec.dict()
297+
f"/{API_VTAG}/containers/compose-spec",
298+
json=containers_compose_spec.model_dump(),
298299
)
299300
containers_create = ContainersCreate(metrics_params=mock_metrics_params)
300301
response = await httpx_async_client.post(
301-
f"/{API_VTAG}/containers", json=containers_create.dict()
302+
f"/{API_VTAG}/containers", json=containers_create.model_dump()
302303
)
303304
task_id: TaskId = response.json()
304305
assert isinstance(task_id, str)

services/dynamic-sidecar/tests/unit/test_api_rest_health.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ async def test_is_healthy(test_client: TestClient) -> None:
1818
test_client.application.state.application_health.is_healthy = True
1919
response = await test_client.get("/health")
2020
assert response.status_code == status.HTTP_200_OK, response
21-
assert response.json() == ApplicationHealth(is_healthy=True).dict()
21+
assert response.json() == ApplicationHealth(is_healthy=True).model_dump()
2222

2323

2424
async def test_is_unhealthy(test_client: TestClient) -> None:
2525
test_client.application.state.application_health.is_healthy = False
2626
response = await test_client.get("/health")
2727
assert response.status_code == status.HTTP_503_SERVICE_UNAVAILABLE, response
28-
assert response.json() == {"detail": ApplicationHealth(is_healthy=False).dict()}
28+
assert response.json() == {
29+
"detail": ApplicationHealth(is_healthy=False).model_dump()
30+
}
2931

3032

3133
async def test_is_unhealthy_via_rabbitmq(test_client: TestClient) -> None:

services/dynamic-sidecar/tests/unit/test_api_rest_prometheus_metrics.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ async def _get_task_id_create_service_containers(
111111
docker_compose_yaml=compose_spec,
112112
)
113113
await httpx_async_client.post(
114-
f"/{API_VTAG}/containers/compose-spec", json=ctontainers_compose_spec.dict()
114+
f"/{API_VTAG}/containers/compose-spec",
115+
json=ctontainers_compose_spec.model_dump(),
115116
)
116117
containers_create = ContainersCreate(metrics_params=mock_metrics_params)
117118
response = await httpx_async_client.post(
118-
f"/{API_VTAG}/containers", json=containers_create.dict()
119+
f"/{API_VTAG}/containers", json=containers_create.model_dump()
119120
)
120121
task_id: TaskId = response.json()
121122
assert isinstance(task_id, str)

services/dynamic-sidecar/tests/unit/test_api_rest_workflow_service_metrics.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,16 @@ async def _get_task_id_create_service_containers(
149149
compose_spec: str,
150150
mock_metrics_params: CreateServiceMetricsAdditionalParams,
151151
) -> TaskId:
152-
ctontainers_compose_spec = ContainersComposeSpec(
152+
containers_compose_spec = ContainersComposeSpec(
153153
docker_compose_yaml=compose_spec,
154154
)
155155
await httpx_async_client.post(
156-
f"/{API_VTAG}/containers/compose-spec", json=ctontainers_compose_spec.dict()
156+
f"/{API_VTAG}/containers/compose-spec",
157+
json=containers_compose_spec.model_dump(),
157158
)
158159
containers_create = ContainersCreate(metrics_params=mock_metrics_params)
159160
response = await httpx_async_client.post(
160-
f"/{API_VTAG}/containers", json=containers_create.dict()
161+
f"/{API_VTAG}/containers", json=containers_create.model_dump()
161162
)
162163
task_id: TaskId = response.json()
163164
assert isinstance(task_id, str)

0 commit comments

Comments
 (0)