Skip to content

Commit 72b3c5c

Browse files
committed
Refactor parameter model construction in deployment service
This commit updates the parameter model construction in the `PipelineDeploymentService` to use keyword arguments for better clarity. Additionally, it modifies the mocking of the `build_params_model_from_snapshot` function in the unit tests to align with the new signature. No functional changes were made to the application code outside of these improvements.
1 parent a1017c0 commit 72b3c5c

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/zenml/deployers/server/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def initialize(self) -> None:
137137

138138
# Build parameter model
139139
self._params_model = build_params_model_from_snapshot(
140-
self.snapshot, strict=True
140+
snapshot=self.snapshot
141141
)
142142

143143
# Initialize orchestrator

tests/unit/deployers/serving/test_service.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def _make_snapshot() -> SimpleNamespace:
5050
input_schema={"type": "object"},
5151
output_schema={"type": "object"},
5252
outputs=[],
53+
source="test.module.pipeline",
5354
)
5455
stack = SimpleNamespace(name="test_stack")
5556

@@ -140,8 +141,8 @@ def __init__(self) -> None:
140141
)
141142

142143
monkeypatch.setattr(
143-
"zenml.deployers.server.parameters.build_params_model_from_snapshot",
144-
lambda snapshot, strict: WeatherParams,
144+
"zenml.deployers.server.service.build_params_model_from_snapshot",
145+
lambda *, snapshot: WeatherParams,
145146
)
146147

147148
mock_orchestrator = mocker.MagicMock()
@@ -183,11 +184,8 @@ def test_execute_pipeline_calls_subroutines(mocker: MockerFixture) -> None:
183184
}
184185
mapped_outputs = {"result": "value"}
185186

186-
service._prepare_execute_with_orchestrator = mocker.MagicMock(
187-
return_value=placeholder_run
188-
)
189187
service._execute_with_orchestrator = mocker.MagicMock(
190-
return_value=captured_outputs
188+
return_value=(placeholder_run, captured_outputs)
191189
)
192190
service._map_outputs = mocker.MagicMock(return_value=mapped_outputs)
193191
service._build_response = mocker.MagicMock(return_value="response")
@@ -198,9 +196,9 @@ def test_execute_pipeline_calls_subroutines(mocker: MockerFixture) -> None:
198196
result = service.execute_pipeline(request)
199197

200198
assert result == "response"
201-
service._prepare_execute_with_orchestrator.assert_called_once_with()
202199
service._execute_with_orchestrator.assert_called_once_with(
203-
placeholder_run, {"city": "Berlin", "temperature": 20}, False
200+
resolved_params={"city": "Berlin", "temperature": 20},
201+
use_in_memory=False,
204202
)
205203
service._map_outputs.assert_called_once_with(captured_outputs)
206204
service._build_response.assert_called_once()

0 commit comments

Comments
 (0)