Skip to content

Commit 1f3ee33

Browse files
committed
revert: drop release_hosts signature change + scaffolding (belongs to #287)
The release_hosts provider_data-optional change and the ProviderHandlerBase scaffolding protocol overlap with PR #287 (provider onboarding prep), which owns the cross-provider handler contract and rewrites these same handler files. That work does not belong in this k8s perf/parity PR. Reverts the handler signature changes to main and removes the orphaned scaffolding file (which was an incomplete copy of #287's — missing __init__ and siblings). The contract-test adapter is restored to main's captured-provider_data pattern. The kmock list-semantics fix is unaffected and retained.
1 parent 5e47270 commit 1f3ee33

7 files changed

Lines changed: 30 additions & 312 deletions

File tree

src/orb/providers/base/scaffolding/handler_base.py

Lines changed: 0 additions & 280 deletions
This file was deleted.

src/orb/providers/k8s/infrastructure/handlers/base_handler.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def check_hosts_status(self, request: Request) -> CheckHostsStatusResult:
555555
async def release_hosts(
556556
self,
557557
machine_ids: list[str],
558-
provider_data: Optional[dict[str, Any]] = None,
558+
provider_data: dict[str, Any],
559559
) -> None:
560560
"""Delete the pods/workloads identified by ``machine_ids``.
561561
@@ -565,12 +565,6 @@ async def release_hosts(
565565
so the handler can resolve context without needing the full Request
566566
aggregate. The dict is the same object that was stamped under
567567
``Request.provider_data`` by ``acquire_hosts``.
568-
569-
``provider_data`` defaults to ``None``; concrete handlers treat a
570-
missing dict the same as ``{}`` and fall back to configured defaults
571-
(e.g. the handler's default namespace). This makes the signature
572-
compatible with the base ``ProviderHandlerBase`` contract, which
573-
calls ``release_hosts(machine_ids)`` without provider-specific context.
574568
"""
575569

576570
@classmethod

src/orb/providers/k8s/infrastructure/handlers/deployment_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def check_hosts_status(self, request: Request) -> CheckHostsStatusResult:
232232
async def release_hosts(
233233
self,
234234
machine_ids: list[str],
235-
provider_data: Optional[dict[str, Any]] = None,
235+
provider_data: dict[str, Any],
236236
) -> None:
237237
"""Selective or full release using pod-deletion-cost + replicas patch.
238238
@@ -254,10 +254,8 @@ async def release_hosts(
254254
provider_data: The ``provider_data`` dict stamped onto the
255255
Request aggregate at acquire time. Carries ``namespace``
256256
and ``deployment_name`` (falls back to deterministic
257-
defaults when absent). Defaults to ``None``; treated as
258-
``{}`` internally.
257+
defaults when absent).
259258
"""
260-
provider_data = provider_data or {}
261259
request_id = provider_data.get("request_id", "unknown")
262260
if not machine_ids:
263261
self._logger.debug(

src/orb/providers/k8s/infrastructure/handlers/job_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def check_hosts_status(self, request: Request) -> CheckHostsStatusResult:
196196
async def release_hosts(
197197
self,
198198
machine_ids: list[str],
199-
provider_data: Optional[dict[str, Any]] = None,
199+
provider_data: dict[str, Any],
200200
) -> None:
201201
"""Delete the whole Job (cascade-deletes pods).
202202
@@ -214,14 +214,12 @@ async def release_hosts(
214214
``provider_data["parallelism"]``); a subset is rejected.
215215
provider_data: The ``provider_data`` dict stamped onto the
216216
Request aggregate at acquire time. Carries ``namespace``,
217-
``job_name`` and ``parallelism``. Defaults to ``None``;
218-
treated as ``{}`` internally.
217+
``job_name`` and ``parallelism``.
219218
220219
Raises:
221220
K8sError: When ``machine_ids`` covers fewer pods than the
222221
Job was created with.
223222
"""
224-
provider_data = provider_data or {}
225223
request_id = provider_data.get("request_id", "unknown")
226224
if not machine_ids:
227225
self._logger.debug(

src/orb/providers/k8s/infrastructure/handlers/pod_handler.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ def check_hosts_status(self, request: Request) -> CheckHostsStatusResult:
285285
async def release_hosts(
286286
self,
287287
machine_ids: list[str],
288-
provider_data: Optional[dict[str, Any]] = None,
288+
provider_data: dict[str, Any],
289289
) -> dict[str, Any]:
290290
"""Delete the named pods concurrently; 404s are best-effort.
291291
@@ -306,9 +306,8 @@ async def release_hosts(
306306
provider_data: The ``provider_data`` dict stamped onto the
307307
Request aggregate at acquire time. Carries
308308
``namespace`` (falls back to the provider default when
309-
absent). Defaults to ``None``; treated as ``{}`` internally.
309+
absent).
310310
"""
311-
provider_data = provider_data or {}
312311
request_id = provider_data.get("request_id", "unknown")
313312
if not machine_ids:
314313
self._logger.debug(

src/orb/providers/k8s/infrastructure/handlers/statefulset_handler.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def check_hosts_status(self, request: Request) -> CheckHostsStatusResult:
217217
async def release_hosts(
218218
self,
219219
machine_ids: list[str],
220-
provider_data: Optional[dict[str, Any]] = None,
220+
provider_data: dict[str, Any],
221221
) -> None:
222222
"""Selective or full release using ordinal-aware scale-down.
223223
@@ -253,10 +253,8 @@ async def release_hosts(
253253
provider_data: The ``provider_data`` dict stamped onto the
254254
Request aggregate at acquire time. Carries ``namespace``
255255
and ``statefulset_name`` (falls back to deterministic
256-
defaults when absent). Defaults to ``None``; treated as
257-
``{}`` internally.
256+
defaults when absent).
258257
"""
259-
provider_data = provider_data or {}
260258
request_id = provider_data.get("request_id", "unknown")
261259
if not machine_ids:
262260
self._logger.debug(

0 commit comments

Comments
 (0)