Skip to content

Commit

Permalink
Deduplicate hosts in UI (#1668)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerwowen committed Jul 22, 2024
1 parent b31ab1e commit cddbb72
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion deploy-board/deploy_board/webapp/env_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ def get(self, request, name, stage=None):

if not env['deployId']:
capacity_hosts = deploys_helper.get_missing_hosts(request, name, stage)
provisioning_hosts = environ_hosts_helper.get_hosts(request, name, stage)
provisioning_hosts = deduplicate_hosts(environ_hosts_helper.get_hosts(request, name, stage))

response = render(request, 'environs/env_landing.html', {
"envs": envs,
Expand Down Expand Up @@ -589,6 +589,17 @@ def get(self, request, name, stage=None):

return response


def deduplicate_hosts(hosts):
results = []
seen = set()
for h in hosts:
host_id = h['hostId']
if host_id not in seen:
seen.add(host_id)
results.append(h)
return results

def _get_asg_suspended_processes(request, env):
try:
cluster_name = get_cluster_name(request, env.get('envName'), env.get('stageName'), env=env)
Expand Down

0 comments on commit cddbb72

Please sign in to comment.