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

Side by Side Diff: masters/master-common-rules.mk

Issue 1883813003: Flock master startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Remove spurious envars. Created 4 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « .gitignore ('k') | masters/start_master.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # -*- makefile -*- 1 # -*- makefile -*-
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This should be included by a makefile which lives in a buildmaster/buildslave 6 # This should be included by a makefile which lives in a buildmaster/buildslave
7 # directory (next to the buildbot.tac file). That including makefile *must* 7 # directory (next to the buildbot.tac file). That including makefile *must*
8 # define MASTERPATH. 8 # define MASTERPATH.
9 9
10 # The 'start' and 'stop' targets start and stop the buildbot master. 10 # The 'start' and 'stop' targets start and stop the buildbot master.
11 # The 'reconfig' target will tell a buildmaster to reload its config file. 11 # The 'reconfig' target will tell a buildmaster to reload its config file.
12 12
13 # Note that a relative PYTHONPATH entry is relative to the current directory. 13 # Note that a relative PYTHONPATH entry is relative to the current directory.
14 14
15 # Confirm that MASTERPATH has been defined. 15 # Confirm that MASTERPATH has been defined.
16 ifeq ($(MASTERPATH),) 16 ifeq ($(MASTERPATH),)
17 $(error MASTERPATH not defined.) 17 $(error MASTERPATH not defined.)
18 endif 18 endif
19 19
20 # Use the puppet-managed infra-python CIPD deployment (which all masters have). 20 # Use the puppet-managed infra-python CIPD deployment (which all masters have).
21 INFRA_RUNPY = /opt/infra-python/run.py 21 INFRA_RUNPY = /opt/infra-python/run.py
22 22
23 # Get the current host's short hostname. We may use this in Makefiles that 23 # Get the current host's short hostname. We may use this in Makefiles that
24 # include this file. 24 # include this file.
25 SHORT_HOSTNAME := $(shell hostname -s) 25 SHORT_HOSTNAME := $(shell hostname -s)
26 CURRENT_DIR = $(shell pwd) 26 CURRENT_DIR = $(shell pwd)
27 27
28 # Where we expect flock to live.
29 FLOCK = /usr/bin/flock
30
31 # Per-master lockfile.
32 LOCKFILE = master_start.lock
33
28 printstep: 34 printstep:
29 ifndef NO_REVISION_AUDIT 35 ifndef NO_REVISION_AUDIT
30 @echo "** `python -c 'import datetime; print datetime.datetime.utcnow() .isoformat() + "Z"'` make $(MAKECMDGOALS)" >> actions.log 36 @echo "** `python -c 'import datetime; print datetime.datetime.utcnow() .isoformat() + "Z"'` make $(MAKECMDGOALS)" >> actions.log
31 @pstree --show-parents $$$$ --ascii --arguments --show-pids >> actions.l og 37 @pstree --show-parents $$$$ --ascii --arguments --show-pids >> actions.l og
32 endif 38 endif
33 39
34 notify: 40 notify:
35 @if (hostname -f | grep -q '^master.*\.chromium\.org'); then \ 41 @if (hostname -f | grep -q '^master.*\.chromium\.org'); then \
36 /bin/echo ; \ 42 /bin/echo ; \
37 /bin/echo -e "\033[1;31m***"; \ 43 /bin/echo -e "\033[1;31m***"; \
(...skipping 18 matching lines...) Expand all
56 $(GCLIENT) diff >> actions.log || true 62 $(GCLIENT) diff >> actions.log || true
57 @($(INFRA_RUNPY) infra.tools.send_monitoring_event \ 63 @($(INFRA_RUNPY) infra.tools.send_monitoring_event \
58 --service-event-revinfo=$(CURRENT_DIR)/revinfo.log \ 64 --service-event-revinfo=$(CURRENT_DIR)/revinfo.log \
59 --service-event-type=START \ 65 --service-event-type=START \
60 --event-mon-run-type=prod \ 66 --event-mon-run-type=prod \
61 --event-mon-service-name \ 67 --event-mon-service-name \
62 buildbot/master/$(MASTERPATH) \ 68 buildbot/master/$(MASTERPATH) \
63 || echo 'Running send_monitoring_event failed, skipping sending events.' \ 69 || echo 'Running send_monitoring_event failed, skipping sending events.' \
64 ) 2>&1 | tee -a actions.log 70 ) 2>&1 | tee -a actions.log
65 endif 71 endif
66 » # There is a race condition between startup and when twistd.pid is writt en. 72 ifneq ($(wildcard $(FLOCK)),)
67 » # Anyone issuing a second `make start` before the twistd.pid is written will 73 » PYTHONPATH=$(PYTHONPATH) SCRIPTS_DIR=$(SCRIPTS_DIR) $(FLOCK) -n $(LOCKFI LE) $(TOPLEVEL_DIR)/masters/start_master.sh || ( \
68 » # spawn two masters. This is hopefully unlikely, but a proper solution w ould 74 » echo "Failure to start master. Check to see if a master is running and" \
69 » # be to use flock (not available on OSX). The critical section contains BOTH 75 » "holding the lock on $(LOCKFILE)."; exit 1)
70 » # the twistd start and the wait for the twistd.pid. 76 else
71 » @echo 'Now running Buildbot master.' 77 » PYTHONPATH=$(PYTHONPATH) SCRIPTS_DIR=$(SCRIPTS_DIR) $(TOPLEVEL_DIR)/mast ers/start_master.sh
72 » PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/twistd --no_save - y buildbot.tac 78 endif
73 » @echo 'Waiting for creation of twistd.pid...' 79
74 » while `test ! -f twistd.pid`; do sleep 1; done;
75 80
76 ifeq ($(BUILDBOT_PATH),$(BUILDBOT8_PATH)) 81 ifeq ($(BUILDBOT_PATH),$(BUILDBOT8_PATH))
77 start-prof: bootstrap 82 start-prof: bootstrap
78 else 83 else
79 start-prof: 84 start-prof:
80 endif 85 endif
81 TWISTD_PROFILE=1 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/t wistd --no_save -y buildbot.tac 86 TWISTD_PROFILE=1 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/t wistd --no_save -y buildbot.tac
82 87
83 stop: notify printstep 88 stop: notify printstep
84 ifndef NO_REVISION_AUDIT 89 ifndef NO_REVISION_AUDIT
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 PYTHONPATH=$(PYTHONPATH) python buildbot upgrade-master . 136 PYTHONPATH=$(PYTHONPATH) python buildbot upgrade-master .
132 137
133 # This target is only known to be useful on 0.8.x masters. 138 # This target is only known to be useful on 0.8.x masters.
134 bootstrap: printstep 139 bootstrap: printstep
135 @[ -e '.dbconfig' ] || [ -e 'state.sqlite' ] || \ 140 @[ -e '.dbconfig' ] || [ -e 'state.sqlite' ] || \
136 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/tools/state_create.py \ 141 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/tools/state_create.py \
137 --restore --db='state.sqlite' --txt '../state-template.txt' 142 --restore --db='state.sqlite' --txt '../state-template.txt'
138 143
139 setup: 144 setup:
140 @echo export PYTHONPATH=$(PYTHONPATH) 145 @echo export PYTHONPATH=$(PYTHONPATH)
OLDNEW
« no previous file with comments | « .gitignore ('k') | masters/start_master.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698