Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1153)

Unified Diff: infra/libs/buildbot/master.py

Issue 1128783003: Add master_manager_launch script which launches master_manager scripts for each master on a host. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address agable's comments. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | infra/libs/buildbot/test/master_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/libs/buildbot/master.py
diff --git a/infra/libs/buildbot/master.py b/infra/libs/buildbot/master.py
index 816a3caa3e65bf29ada8108f545a110f1cabe688..e6eccaaa5ac52be3e8343c5e64710616d903584e 100644
--- a/infra/libs/buildbot/master.py
+++ b/infra/libs/buildbot/master.py
@@ -93,21 +93,38 @@ def get_last_no_new_builds(directory):
return last_no_new_builds
-def get_mastermap_data(directory):
- """Get mastermap JSON from a master directory."""
+def _call_mastermap(build_dir):
+ """Given a build/ directory, obtain the full mastermap.json.
- build_dir = os.path.join(directory, os.pardir, os.pardir, os.pardir, 'build')
+ This checks if build_internal/ is checked out next to build/ and uses
+ mastermap_internal.py if present.
+ """
runit = os.path.join(build_dir, 'scripts', 'tools', 'runit.py')
- build_internal_dir = os.path.join(build_dir, os.pardir, 'build_internal')
+ build_internal_dir = os.path.join(
+ os.path.dirname(build_dir), 'build_internal')
script_path = os.path.join(build_dir, 'scripts', 'tools', 'mastermap.py')
if os.path.exists(build_internal_dir):
script_path = os.path.join(
build_internal_dir, 'scripts', 'tools', 'mastermap_internal.py')
- script_data = json.loads(subprocess.check_output(
+ return json.loads(subprocess.check_output(
[runit, script_path, '-f', 'json']))
+
+def get_mastermap_for_host(build_dir, hostname):
+ """Get mastermap JSON for all masters on a specific host."""
+ script_data = _call_mastermap(build_dir)
+ return [x for x in script_data if x.get('fullhost') == hostname]
+
+
+def get_mastermap_data(directory):
+ """Get mastermap JSON for a specific master."""
+
+ build_dir = os.path.join(
+ os.path.dirname(os.path.dirname(os.path.dirname(directory))), 'build')
+ script_data = _call_mastermap(build_dir)
+
short_dirname = os.path.basename(directory)
matches = [x for x in script_data if x.get('dirname') == short_dirname]
assert len(matches) < 2, (
« no previous file with comments | « no previous file | infra/libs/buildbot/test/master_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698