You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/06 23:12:21 UTC
[07/12] couchdb commit: updated refs/heads/1843-feature-bigcouch to
152a21a
Make the process list a global in dev/run
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/49cb5517
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/49cb5517
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/49cb5517
Branch: refs/heads/1843-feature-bigcouch
Commit: 49cb55177b0177c61f7eacff0e65b2be3b9082c1
Parents: dc75c75
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Feb 6 16:05:47 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Feb 6 16:06:59 2014 -0600
----------------------------------------------------------------------
dev/run | 51 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/49cb5517/dev/run
----------------------------------------------------------------------
diff --git a/dev/run b/dev/run
index c4c68af..aa3d313 100755
--- a/dev/run
+++ b/dev/run
@@ -28,7 +28,9 @@ import urllib
USAGE = "%prog [options] [command to run...]"
DEV_PATH = os.path.dirname(os.path.abspath(__file__))
COUCHDB = os.path.dirname(DEV_PATH)
+
N = 3
+PROCESSES = []
def init_log_dir():
@@ -168,15 +170,40 @@ def connect_nodes(backdoor):
sp.check_call(cmd, shell=True)
+def kill_processes():
+ global PROCESSES
+ for p in PROCESSES:
+ if p.returncode is None:
+ p.kill()
+
+
+def boot_nodes():
+ global N, PROCESSES
+ for i in range(1, N+1):
+ p = boot_node("node%d" % i)
+ PROCESSES.append(p)
+
+ for i in range(30):
+ if all_nodes_alive(N):
+ break
+ time.sleep(1)
+
+
+def reboot_nodes():
+ kill_processes()
+ boot_nodes()
+
+
def run_command(cmd):
p = sp.Popen(cmd, shell=True)
p.wait()
exit(p.returncode)
-def wait_for_procs(procs):
+def wait_for_procs():
+ global PROCESSES
while True:
- for p in procs:
+ for p in PROCESSES:
if p.returncode is not None:
exit(1)
time.sleep(2)
@@ -197,29 +224,15 @@ def main():
init_beams()
write_configs(opts)
- procs = []
-
- def kill_procs():
- for p in procs:
- if p.returncode is None:
- p.terminate()
- atexit.register(kill_procs)
-
- for i in range(1, 4):
- p = boot_node("node%d" % i)
- procs.append(p)
-
- for i in range(30):
- if all_nodes_alive(N):
- break
- time.sleep(1)
+ atexit.register(kill_processes)
+ boot_nodes()
connect_nodes("http://127.0.0.1:15986/")
if len(args):
run_command(" ".join(args))
else:
- wait_for_procs(procs)
+ wait_for_procs()
if __name__ == "__main__":