File tree Expand file tree Collapse file tree
sokovan/deployment/strategy Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import logging
44import uuid
55from datetime import datetime
6- from typing import TYPE_CHECKING , Union
6+ from typing import TYPE_CHECKING
77
88import sqlalchemy as sa
99from pydantic import BaseModel , Field , model_validator
@@ -62,7 +62,7 @@ class BlueGreenSpec(BaseModel):
6262 promote_delay_seconds : int = 0
6363
6464
65- DeploymentStrategySpec = Union [ RollingUpdateSpec , BlueGreenSpec ]
65+ DeploymentStrategySpec = RollingUpdateSpec | BlueGreenSpec
6666
6767
6868def _get_endpoint_join_condition () -> sa .ColumnElement [bool ]:
Original file line number Diff line number Diff line change @@ -80,7 +80,8 @@ def evaluate_cycle(
8080 sweep handles it by transitioning to ROLLING_BACK when the
8181 deploying timeout is exceeded.
8282 """
83- assert isinstance (spec , RollingUpdateSpec )
83+ if not isinstance (spec , RollingUpdateSpec ):
84+ raise TypeError (f"Expected RollingUpdateSpec, got { type (spec ).__name__ } " )
8485 desired = deployment .replica_spec .target_replica_count
8586 deploying_revision_id = deployment .deploying_revision_id
8687 if deploying_revision_id is None :
@@ -136,7 +137,11 @@ def _check_completed(
136137 desired : int ,
137138 ) -> StrategyCycleResult | None :
138139 """Return COMPLETED result if all old routes are replaced and enough new are healthy."""
139- if classified .old_active or classified .new_healthy_count < desired :
140+ if (
141+ classified .old_active
142+ or classified .new_provisioning_count
143+ or classified .new_healthy_count < desired
144+ ):
140145 return None
141146 log .info (
142147 "deployment {}: rolling update complete ({} healthy routes)" ,
You can’t perform that action at this time.
0 commit comments