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

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

Issue 1890453006: Revert of Flock master startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: 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
34 printstep: 28 printstep:
35 ifndef NO_REVISION_AUDIT 29 ifndef NO_REVISION_AUDIT
36 @echo "** `python -c 'import datetime; print datetime.datetime.utcnow() .isoformat() + "Z"'` make $(MAKECMDGOALS)" >> actions.log 30 @echo "** `python -c 'import datetime; print datetime.datetime.utcnow() .isoformat() + "Z"'` make $(MAKECMDGOALS)" >> actions.log
37 @pstree --show-parents $$$$ --ascii --arguments --show-pids >> actions.l og 31 @pstree --show-parents $$$$ --ascii --arguments --show-pids >> actions.l og
38 endif 32 endif
39 33
40 notify: 34 notify:
41 @if (hostname -f | grep -q '^master.*\.chromium\.org'); then \ 35 @if (hostname -f | grep -q '^master.*\.chromium\.org'); then \
42 /bin/echo ; \ 36 /bin/echo ; \
43 /bin/echo -e "\033[1;31m***"; \ 37 /bin/echo -e "\033[1;31m***"; \
(...skipping 18 matching lines...) Expand all
62 $(GCLIENT) diff >> actions.log || true 56 $(GCLIENT) diff >> actions.log || true
63 @($(INFRA_RUNPY) infra.tools.send_monitoring_event \ 57 @($(INFRA_RUNPY) infra.tools.send_monitoring_event \
64 --service-event-revinfo=$(CURRENT_DIR)/revinfo.log \ 58 --service-event-revinfo=$(CURRENT_DIR)/revinfo.log \
65 --service-event-type=START \ 59 --service-event-type=START \
66 --event-mon-run-type=prod \ 60 --event-mon-run-type=prod \
67 --event-mon-service-name \ 61 --event-mon-service-name \
68 buildbot/master/$(MASTERPATH) \ 62 buildbot/master/$(MASTERPATH) \
69 || echo 'Running send_monitoring_event failed, skipping sending events.' \ 63 || echo 'Running send_monitoring_event failed, skipping sending events.' \
70 ) 2>&1 | tee -a actions.log 64 ) 2>&1 | tee -a actions.log
71 endif 65 endif
72 ifneq ($(wildcard $(FLOCK)),) 66 » # There is a race condition between startup and when twistd.pid is writt en.
73 » PYTHONPATH=$(PYTHONPATH) SCRIPTS_DIR=$(SCRIPTS_DIR) $(FLOCK) -n $(LOCKFI LE) $(TOPLEVEL_DIR)/masters/start_master.sh || ( \ 67 » # Anyone issuing a second `make start` before the twistd.pid is written will
74 » echo "Failure to start master. Check to see if a master is running and" \ 68 » # spawn two masters. This is hopefully unlikely, but a proper solution w ould
75 » "holding the lock on $(LOCKFILE)."; exit 1) 69 » # be to use flock (not available on OSX). The critical section contains BOTH
76 else 70 » # the twistd start and the wait for the twistd.pid.
77 » PYTHONPATH=$(PYTHONPATH) SCRIPTS_DIR=$(SCRIPTS_DIR) $(TOPLEVEL_DIR)/mast ers/start_master.sh 71 » @echo 'Now running Buildbot master.'
78 endif 72 » PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/twistd --no_save - y buildbot.tac
79 73 » @echo 'Waiting for creation of twistd.pid...'
74 » while `test ! -f twistd.pid`; do sleep 1; done;
80 75
81 ifeq ($(BUILDBOT_PATH),$(BUILDBOT8_PATH)) 76 ifeq ($(BUILDBOT_PATH),$(BUILDBOT8_PATH))
82 start-prof: bootstrap 77 start-prof: bootstrap
83 else 78 else
84 start-prof: 79 start-prof:
85 endif 80 endif
86 TWISTD_PROFILE=1 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/t wistd --no_save -y buildbot.tac 81 TWISTD_PROFILE=1 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/common/t wistd --no_save -y buildbot.tac
87 82
88 stop: notify printstep 83 stop: notify printstep
89 ifndef NO_REVISION_AUDIT 84 ifndef NO_REVISION_AUDIT
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 PYTHONPATH=$(PYTHONPATH) python buildbot upgrade-master . 131 PYTHONPATH=$(PYTHONPATH) python buildbot upgrade-master .
137 132
138 # This target is only known to be useful on 0.8.x masters. 133 # This target is only known to be useful on 0.8.x masters.
139 bootstrap: printstep 134 bootstrap: printstep
140 @[ -e '.dbconfig' ] || [ -e 'state.sqlite' ] || \ 135 @[ -e '.dbconfig' ] || [ -e 'state.sqlite' ] || \
141 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/tools/state_create.py \ 136 PYTHONPATH=$(PYTHONPATH) python $(SCRIPTS_DIR)/tools/state_create.py \
142 --restore --db='state.sqlite' --txt '../state-template.txt' 137 --restore --db='state.sqlite' --txt '../state-template.txt'
143 138
144 setup: 139 setup:
145 @echo export PYTHONPATH=$(PYTHONPATH) 140 @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