Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-extensio-on-workers to citus_dev #77

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions citus_dev/citus_dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
"""citus_dev

Usage:
citus_dev make <name> [--size=<count>] [--port=<port>] [--use-ssl] [--no-extension] [--mx] [--destroy] [--init-with=<sql_file>]
citus_dev make <name> [--size=<count>] [--port=<port>] [--use-ssl] [--no-extension] [--no-extension-on-workers] [--mx] [--destroy] [--init-with=<sql_file>]
citus_dev restart <name> [--watch] [--port=<port>]
citus_dev (start|stop) <name> [--port=<port>]

Options:
--size=<count> Number of workers to create when 0 the coordinator will be added as a worker [default: 2]
--port=<port> Port number to use for the coordinator. All workers take subsequent numbers [default: 9700]
--watch Watch for changes to the citus plugin and restart the cluster when the plugin updates
--use-ssl Create the cluster with ssl enabled
--no-extension Do not create the extension while creating the nodes
--mx Enable metadata sync for all workers
--destroy Destroy any old cluster with the same name
--init-with=<sql_file> A SQL script to run after creation of the cluster to set up any necessary tables and data
--size=<count> Number of workers to create when 0 the coordinator will be added as a worker [default: 2]
--port=<port> Port number to use for the coordinator. All workers take subsequent numbers [default: 9700]
--watch Watch for changes to the citus plugin and restart the cluster when the plugin updates
--use-ssl Create the cluster with ssl enabled
--no-extension Do not create the extension while creating the nodes
--no-extension-on-workers Do not create the extension on the workers while creating the nodes
--mx Enable metadata sync for all workers
--destroy Destroy any old cluster with the same name
--init-with=<sql_file> A SQL script to run after creation of the cluster to set up any necessary tables and data

"""
from docopt import docopt
Expand Down Expand Up @@ -67,9 +68,14 @@ def main(arguments):
if arguments["make"]:
if arguments['--destroy']:
name = arguments["<name>"]
for role in getRoles(name):
run("pg_ctl stop -D %s/%s || true" % (name, role))
run('rm -rf %s' % (name))
try:
roles = getRoles(name)
except Exception:
pass
else:
for role in roles:
run("pg_ctl stop -D %s/%s || true" % (name, role))
run('rm -rf %s' % (name))

createNodeCommands(
arguments["<name>"],
Expand Down Expand Up @@ -115,8 +121,11 @@ def main(arguments):
run('createdb -p %d' % (port + i))

if not arguments["--no-extension"]:
for i in range(size + 1):
run('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i))
if arguments["--no-extension-on-workers"]:
run('psql -p %d -c "CREATE EXTENSION citus;"' % (port))
else:
for i in range(size + 1):
run('psql -p %d -c "CREATE EXTENSION citus;"' % (port + i))

# If the cluster size is 0 we add the coordinator as the only node, otherwise we will add all other nodes
if size == 0:
Expand Down