Commit 1d4cf0c8 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Reset process pid when killed, allow start the cluster without some storage

processes.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1190 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7eeafe4d
...@@ -108,6 +108,7 @@ class NEOProcess: ...@@ -108,6 +108,7 @@ class NEOProcess:
if self.pid: if self.pid:
try: try:
os.kill(self.pid, sig) os.kill(self.pid, sig)
self.pid = 0
except OSError: except OSError:
traceback.print_last() traceback.print_last()
else: else:
...@@ -144,6 +145,7 @@ class NEOProcess: ...@@ -144,6 +145,7 @@ class NEOProcess:
return self.port return self.port
class NEOCluster(object): class NEOCluster(object):
def __init__(self, db_list, master_node_count=1, def __init__(self, db_list, master_node_count=1,
partitions=1, replicas=0, port_base=10000, partitions=1, replicas=0, port_base=10000,
db_user='neo', db_password='neo', db_user='neo', db_password='neo',
...@@ -239,11 +241,12 @@ class NEOCluster(object): ...@@ -239,11 +241,12 @@ class NEOCluster(object):
cursor.close() cursor.close()
sql_connection.close() sql_connection.close()
def start(self): def start(self, except_storages=[]):
neoctl = self.neoctl neoctl = self.neoctl
assert len(self.process_dict) assert len(self.process_dict)
for process_list in self.process_dict.itervalues(): for process_list in self.process_dict.itervalues():
for process in process_list: for process in process_list:
if process not in except_storages:
process.start() process.start()
# Try to put cluster in running state. This will succeed as soon as # Try to put cluster in running state. This will succeed as soon as
# admin node could connect to the primary master node. # admin node could connect to the primary master node.
...@@ -254,7 +257,7 @@ class NEOCluster(object): ...@@ -254,7 +257,7 @@ class NEOCluster(object):
time.sleep(0.5) time.sleep(0.5)
else: else:
break break
target_count = len(self.db_list) target_count = len(self.db_list) - len(except_storages)
while True: while True:
storage_node_list = neoctl.getNodeList( storage_node_list = neoctl.getNodeList(
node_type=protocol.STORAGE_NODE_TYPE) node_type=protocol.STORAGE_NODE_TYPE)
......
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