Skip to content

Commit

Permalink
refactor: replace Operation.component_name with Operation.name.component
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulFarault committed Nov 21, 2024
1 parent d73ae3d commit d830730
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tdp/core/cluster_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ def generate_stale_sch_logs(
log = logs.setdefault(
create_hosted_entity(
create_entity_name(
operation.name.service, operation.component_name
operation.name.service, operation.name.component
),
host,
),
SCHStatusLogModel(
service=operation.name.service,
component=operation.component_name,
component=operation.name.component,
host=host,
source=SCHStatusLogSourceEnum.STALE,
),
Expand Down
4 changes: 2 additions & 2 deletions tdp/core/collections/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ def _init_hostable_entities(self) -> dict[str, set[ServiceComponentName]]:
services_components: dict[str, set[ServiceComponentName]] = {}
for operation in self.operations.values():
service = services_components.setdefault(operation.name.service, set())
if not operation.component_name:
if not operation.name.component:
continue
service.add(
ServiceComponentName(operation.name.service, operation.component_name)
ServiceComponentName(operation.name.service, operation.name.component)
)
return services_components
2 changes: 1 addition & 1 deletion tdp/core/deployment/deployment_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _process_operation_fn(

sch_status_logs: list[SCHStatusLogModel] = []
entity_name = create_entity_name(
operation.name.service, operation.component_name
operation.name.service, operation.name.component
)

if self._cluster_status.is_sc_stale(entity_name, hosts=operation.host_names):
Expand Down
1 change: 0 additions & 1 deletion tdp/core/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def __init__(
self.noop = noop
self.host_names = host_names or set()

self.component_name = self.name.component
self.action_name = self.name.action

for host_name in self.host_names:
Expand Down
4 changes: 2 additions & 2 deletions test_dag_order/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ def stale_sc(plan_reconfigure: DeploymentModel) -> set[str]:
for operation in plan_reconfigure.operations:
# TODO: would be nice to use a dedicated class to parse the operation name
operation = Operation(operation.operation)
if operation.component_name is None:
if operation.name.component is None:
sc.add(operation.name.service)
else:
sc.add(operation.name.service + "_" + operation.component_name)
sc.add(operation.name.service + "_" + operation.name.component)
return sc

0 comments on commit d830730

Please sign in to comment.