diff --git a/binder/init b/binder/init deleted file mode 100755 index c381fca4e..000000000 --- a/binder/init +++ /dev/null @@ -1,13 +0,0 @@ -VERSION=`cat VERSION` -PORT=`cat PORT` -MONGODB_BIN=`m bin $VERSION` -mlaunch init --replicaset --name repl0 --nodes 3 --binarypath \ -$MONGODB_BIN --port $PORT --hostname localhost --setParameter \ -enableTestCommands=1 -mongo -VERSION=`cat VERSION` -PORT=`cat PORT` -MONGODB_BIN=`m bin $VERSION` -CMD="$MONGODB_BIN/mongo mongodb://localhost:$PORT/?replicaSet=repl0" -echo "$CMD" -$CMD \ No newline at end of file diff --git a/binder/start b/binder/start index 9d0be50f2..de053f4d8 100755 --- a/binder/start +++ b/binder/start @@ -2,11 +2,26 @@ import sys import shutil import os +import shlex import subprocess +HERE = os.path.abspath(os.path.dirname(__file__)) + +with open(os.path.join(HERE, 'VERSION')) as fid: + VERSION = fid.read().strip() + +with open(os.path.join(HERE, 'PORT')) as fid: + PORT = fid.read().strip() + # Start the local mongodb as a background task -binder_folder = os.path.join(os.getcwd(), 'binder') -subprocess.check_call(['bash', 'init'], shell=True, cwd=binder_folder) +MONGODB_BIN = subprocess.check_output(['m', 'bin', VERSION]).decode('utf-8').strip() + +cmd = ['mlaunch', 'init', '--replicaset', '--name', 'repl0', '--nodes', '3', '--binarypath', +MONGODB_BIN, '--port', PORT, '--hostname', 'localhost', '--setParameter', +'enableTestCommands=1'] + +print(cmd) +subprocess.check_call(cmd, cwd=HERE) # Launch Jupyter argv = sys.argv[1:]