Commit da0a323e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c86f2da3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
# Copyright (C) 2020-2021 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
......@@ -22,6 +22,8 @@
Usage: runneo.py <workdir> <cluster-name> [k1=v1] [k2=v2] ...
{k->v} dict is optional arguments for NEOCluster.
<workdir>/ready is created with address of master after spawned cluster becomes
operational.
"""
......@@ -55,6 +57,7 @@ def main():
raise SystemExit(sinfo("terminated"))
signal(SIGTERM, _)
# SSL setup
flags = ' !ssl'
ca = kw.pop('ca', None)
cert = kw.pop('cert', None)
......@@ -66,6 +69,7 @@ def main():
flags = ' ssl'
NEOCluster.SSL = (ca, cert, key)
# Start the cluster
cluster = NEOCluster([clusterName], adapter='SQLite', name=clusterName, temp_dir=workdir, **kw)
cluster.start()
defer(cluster.stop)
......@@ -73,7 +77,7 @@ def main():
cluster.expectClusterRunning()
info("started master(s): %s" % (cluster.master_nodes,))
# dump information about ready cluster into readyfile
# dump information about ready cluster into readyf
with open("%s.tmp" % readyf, "w") as f:
f.write(cluster.master_nodes) # XXX ' ' separated if multiple masters
os.rename("%s.tmp" % readyf, readyf) # atomic
......@@ -82,6 +86,7 @@ def main():
os.unlink(readyf)
defer(_)
# started ok -> serve
while 1:
sleep(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment