You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/09/28 16:50:00 UTC

[31/39] couchdb commit: updated refs/heads/developer-preview-2.0 to 3ac3db6

Add `--node-number` to /dev/run options

This gives the option of specificing the seed number when generating the
node name and the port for that node.

e.g.
 /dev/run --node-number 5
- node5@127.0.0.1 on port 55894


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0b300af1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0b300af1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0b300af1

Branch: refs/heads/developer-preview-2.0
Commit: 0b300af1614cc75c11f35af44c9acc19bcc7effa
Parents: c43229b
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Sep 22 16:04:50 2015 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Sep 22 16:08:30 2015 +0200

----------------------------------------------------------------------
 dev/run | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0b300af1/dev/run
----------------------------------------------------------------------
diff --git a/dev/run b/dev/run
index 06c96be..2cb1fd7 100755
--- a/dev/run
+++ b/dev/run
@@ -115,6 +115,8 @@ def setup_argparse():
                       help='HAProxy executable path')
     parser.add_option('--haproxy-port', dest='haproxy_port', default='5984',
                       help='HAProxy port')
+    parser.add_option('--node-number', dest="node_number", type=int, default=1,
+                      help='The node number to seed them when creating the node(s)')
     return parser.parse_args()
 
 
@@ -124,7 +126,8 @@ def setup_context(opts, args):
             'no_join': opts.no_join,
             'with_admin_party': opts.with_admin_party,
             'admin': opts.admin.split(':', 1) if opts.admin else None,
-            'nodes': ['node%d' % (i + 1) for i in range(opts.nodes)],
+            'nodes': ['node%d' % (i + opts.node_number) for i in range(opts.nodes)],
+            'node_number': opts.node_number,
             'devdir': os.path.dirname(fpath),
             'rootdir': os.path.dirname(os.path.dirname(fpath)),
             'cmd': ' '.join(args),
@@ -157,7 +160,7 @@ def check_beams(ctx):
 @log('Prepare configuration files')
 def setup_configs(ctx):
     for idx, node in enumerate(ctx['nodes']):
-        cluster_port, backend_port = get_ports(idx + 1)
+        cluster_port, backend_port = get_ports(idx + ctx['node_number'])
         env = {
             "prefix": ctx['rootdir'],
             "package_author_name": "The Apache Software Foundation",
@@ -321,7 +324,7 @@ def ensure_all_nodes_alive(ctx):
         for num in range(ctx['N']):
             if status[num]:
                 continue
-            local_port, _ = get_ports(num + 1)
+            local_port, _ = get_ports(num + ctx['node_number'])
             url = "http://127.0.0.1:{0}/".format(local_port)
             try:
                 check_node_alive(url)