- {% include "deploys/deploy_progress.tmpl" %}
+ {% include "deploys/deploy_progress.html" %}
{% include "deploys/deploy_add_ons.tmpl" %}
diff --git a/deploy-board/deploy_board/webapp/env_views.py b/deploy-board/deploy_board/webapp/env_views.py
index e09f787b88..ebeef6332a 100644
--- a/deploy-board/deploy_board/webapp/env_views.py
+++ b/deploy-board/deploy_board/webapp/env_views.py
@@ -248,7 +248,7 @@ def update_deploy_progress(request, name, stage):
"accounts": accounts,
}
- html = render_to_string('deploys/deploy_progress.tmpl', context)
+ html = render_to_string('deploys/deploy_progress.html', context)
response = HttpResponse(html)
@@ -628,7 +628,7 @@ def _get_last_cluster_refresh_status(request, env):
return replace_summaries["clusterRollingUpdateStatuses"][0]
except:
return None
-
+
def _is_cluster_auto_refresh_enabled(request, env):
try:
cluster_name = get_cluster_name(request, env.get('envName'), env.get('stageName'), env=env)
@@ -1140,9 +1140,9 @@ def remove_stage(request, name, stage):
return response
-def get_pipeline_url_from_build_info(build):
+def get_pipeline_url_from_build_info(build):
if build['publishInfo'] and re.findall("https://[\w\d\-\.]*/job/[\w\d\-\.]*/[\d]*(/)?", build['publishInfo']):
- return re.sub("/[\d]*(/)?$", '', build['publishInfo'])
+ return re.sub("/[\d]*(/)?$", '', build['publishInfo'])
if build['publishInfo'] and re.findall("https://[\w\d\-\.]*/job/[\w\d\-\.]*/?", build['publishInfo']):
return build['publishInfo']
return False
@@ -1154,18 +1154,18 @@ def get_builds(request, name, stage):
if env_promote['type'] == 'AUTO' and env_promote['predStage'] and \
env_promote['predStage'] == environs_helper.BUILD_STAGE:
show_lock = True
-
+
if 'buildName' not in env and not env['buildName']:
html = render_to_string('builds/simple_builds.tmpl', {
"builds": [],
- "env": env,
+ "env": env,
"show_lock": show_lock,
})
return HttpResponse(html)
current_publish_date = 0
- build_deploy_pipeline_url = False
-
+ build_deploy_pipeline_url = False
+
if 'deployId' in env and env['deployId']:
deploy = deploys_helper.get(request, env['deployId'])
build = builds_helper.get_build(request, deploy['buildId'])
@@ -1196,7 +1196,7 @@ def get_builds(request, name, stage):
html = render_to_string('builds/simple_builds.tmpl', {
"builds": new_builds,
"build_deploy_pipeline_url" : build_deploy_pipeline_url,
- "current_publish_date": current_publish_date,
+ "current_publish_date": current_publish_date,
"env": env,
"show_lock": show_lock,
})
diff --git a/deploy-board/tools/agent_simulator.py b/deploy-board/tools/agent_simulator.py
index 4756cb833b..2bde03ab01 100644
--- a/deploy-board/tools/agent_simulator.py
+++ b/deploy-board/tools/agent_simulator.py
@@ -1,83 +1,80 @@
+#!/usr/bin/env python3
# Copyright 2016 Pinterest, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
# -*- coding: utf-8 -*-
-''' Simulate l00 hosts to ping server constantly. If group name match the env
+
+""" Simulate l00 hosts to ping server constantly. If group name match the env
capacity config and there is active deploy, it will simulate the full deploy cycle as well.
-'''
-import commons
+"""
+from commons import REQUEST
+from deploy_board.webapp.helpers import systems_helper
import argparse
import time
import threading
states = {}
-systems_helper = commons.get_system_helper()
+HOST_COUNT = 100
-def ping(i, groups):
- host = "host-888-%d" % i
- ip = "%d.%d.%d.%d" % (i, i, i, i)
+def ping(i: str, groups: list):
+ host = f"host-888-{i}"
+ ip = f"{i}.{i}.{i}.{i}"
reports = {}
while True:
pingRequest = {}
- pingRequest['hostId'] = host
- pingRequest['hostName'] = host
- pingRequest['hostIp'] = ip
- pingRequest['groups'] = groups
- pingRequest['reports'] = list(reports.values())
+ pingRequest["hostId"] = host
+ pingRequest["hostName"] = host
+ pingRequest["hostIp"] = ip
+ pingRequest["groups"] = groups
+ pingRequest["reports"] = list(reports.values())
try:
- pingResponse = systems_helper.ping(commons.REQUEST, pingRequest)
+ pingResponse = systems_helper.ping(REQUEST, pingRequest)
except Exception as e:
- print(e.message)
+ print(e)
continue
- if pingResponse.get('opCode') == 'NOOP':
+ if pingResponse.get("opCode") == "NOOP":
continue
- else:
- print("%s :-> %s:%s" % (host,
- pingResponse.get('opCode'),
- pingResponse.get('deployGoal').get('deployStage')))
- goal = pingResponse.get('deployGoal')
+ print(
+ f"{host} :-> {pingResponse.get('opCode')}:{pingResponse.get('deployGoal').get('deployStage')}"
+ )
+ goal = pingResponse.get("deployGoal")
report = {}
- report['envId'] = goal.get('envId')
- report['deployId'] = goal.get('deployId')
- report['agentStatus'] = 'SUCCEEDED'
- report['deployStage'] = goal.get('deployStage')
- reports[goal.get('envId')] = report
+ report["envId"] = goal.get("envId")
+ report["deployId"] = goal.get("deployId")
+ report["agentStatus"] = "SUCCEEDED"
+ report["deployStage"] = goal.get("deployStage")
+ reports[goal.get("envId")] = report
-def main():
- parser = argparse.ArgumentParser(description='Simulate 100 hosts to ping server constantly')
- parser.add_argument('-g', '--group', type=str, help='Group name', required=True)
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(
+ description="Simulate 100 hosts to ping server constantly"
+ )
+ parser.add_argument("-g", "--group", type=str, help="Group name", required=True)
args = parser.parse_args()
groups = [args.group]
- for i in range(100):
- host = "host-sim-%d" % i
- states[host] = False
+ for i in range(HOST_COUNT):
+ states[f"host-sim-{i}"] = False
- for i in range(100):
- t = threading.Thread(target=ping, args=(i, groups))
- t.daemon = True
+ for i in range(HOST_COUNT):
+ t = threading.Thread(target=ping, args=(i, groups), daemon=True)
t.start()
while True:
time.sleep(5)
continue
-
-
-if __name__ == "__main__":
- main()