Skip to content

Commit

Permalink
Allow OS-specific hacks with cluster_run
Browse files Browse the repository at this point in the history
Change-Id: I1af406145b5dade29d364676a19f40c20b051989
Reviewed-on: http://review.couchbase.org/10455
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
dustin authored and trondn committed Nov 6, 2011
1 parent 61b51b5 commit a67fbf7
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions cluster_run
Expand Up @@ -61,6 +61,20 @@ def couch_configs(i):
"{0}/etc/couchdb/local.d/geocouch.ini".format(PREFIX),
"couch/n_{0}_conf.ini".format(i)]

def os_specific(args, params):
"""Add os-specific junk to the cluster startup."""
import platform

if platform.system() == 'Darwin':
import resource
## OS X has a pretty tiny default fd limit. Let's increase it
resource.setrlimit(resource.RLIMIT_NOFILE, (2048, 2048))
## Also, we build stuff in kind of dumb ways, so fix the path.
dypath = ("%(pwd)s/../install/lib/memcached:"
"%(pwd)s/../install/lib:/usr/local/lib") % {'pwd': os.getcwd()}
params['env'] = {"DYLD_LIBRARY_PATH": dypath}
params['env'].update(os.environ)

def start_cluster(num_nodes, start_index, host, extra_args):
ebin_path = setup_path()

Expand Down Expand Up @@ -95,10 +109,16 @@ def start_cluster(num_nodes, start_index, host, extra_args):
"moxi_port", str(base_direct_port + i * 2 + 1),
"short_name", '"n_{0}"'.format(i)
] + extra_args
if i == 0:
return subprocess.Popen(args)
else:
return subprocess.Popen(args + ["-noshell"], stdin=subprocess.PIPE)

params = {}

if i > 0:
args += ['-noshell']
params['stdin'] = subprocess.PIPE

os_specific(args, params)

return subprocess.Popen(args, **params)

return [start_node(i + start_index) for i in xrange(num_nodes)]

Expand Down

0 comments on commit a67fbf7

Please sign in to comment.