Skip to content

Commit 51bbcdd

Browse files
committed
feat: DeploymentModel.from_stale_hosted_entities can take all hosted entities
Not only stale one as it is filtering it anyway.
1 parent c6f0747 commit 51bbcdd

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

tdp/cli/commands/plan/reconfigure.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def reconfigure(
3838
with Dao(db_engine, commit_on_exit=True) as dao:
3939
deployment = DeploymentModel.from_stale_hosted_entities(
4040
collections=collections,
41-
stale_hosted_entity_statuses=dao.get_hosted_entity_statuses(
42-
filter_stale=True
43-
),
41+
hosted_entity_statuses=dao.get_hosted_entity_statuses(filter_stale=True),
4442
rolling_interval=rolling_interval,
4543
)
4644
if preview:

tdp/core/deployment/deployment_iterator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ def __init__(
103103
self._reconfigure_operations = _group_hosts_by_operation(
104104
DeploymentModel.from_stale_hosted_entities(
105105
collections=self._collections,
106-
stale_hosted_entity_statuses=[
107-
status for status in cluster_status.values() if status.is_stale
108-
],
106+
hosted_entity_statuses=list(cluster_status.values()),
109107
)
110108
)
111109
except NothingToReconfigureError:

tdp/core/models/deployment_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,21 @@ def from_operations_hosts_vars(
329329
@staticmethod
330330
def from_stale_hosted_entities(
331331
collections: Collections,
332-
stale_hosted_entity_statuses: list[HostedEntityStatus],
332+
hosted_entity_statuses: list[HostedEntityStatus],
333333
rolling_interval: Optional[int] = None,
334334
) -> DeploymentModel:
335335
"""Generate a deployment plan for stale components.
336336
337337
Args:
338338
collections: Collections to retrieve the operations from.
339-
stale_hosted_entity_statuses: List of stale hosted entity statuses.
339+
hosted_entity_statuses: List of hosted entity statuses.
340340
rolling_interval: Number of seconds to wait between component restart.
341341
342342
Raises:
343343
NothingToReconfigureError: If no component needs to be reconfigured.
344344
"""
345345
operation_hosts: set[OperationHostTuple] = set()
346-
for status in stale_hosted_entity_statuses:
346+
for status in hosted_entity_statuses:
347347
if status.to_config:
348348
operation_hosts.add(
349349
OperationHostTuple(

test_dag_order/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def plan_reconfigure(
200200
# return the deployment plan (it is neither persisted in the database nor executed)
201201
return DeploymentModel.from_stale_hosted_entities(
202202
collections=collections,
203-
stale_hosted_entity_statuses=dao.get_hosted_entity_statuses(filter_stale=True),
203+
hosted_entity_statuses=dao.get_hosted_entity_statuses(filter_stale=True),
204204
)
205205

206206

0 commit comments

Comments
 (0)