Skip to content
Snippets Groups Projects
Commit 1d32d3fa authored by Björn Vonheiden's avatar Björn Vonheiden
Browse files

Add reset of zookeeper

parent 2f7a5e5d
Branches DCParadigm
No related tags found
2 merge requests!42Integerate theodolite and run uc python scripts,!24run UC as python implementation
...@@ -364,6 +364,47 @@ def delete_topics(topics): ...@@ -364,6 +364,47 @@ def delete_topics(topics):
break break
return return
def reset_zookeeper():
"""Delete ZooKeeper configurations used for workload generation.
"""
print('Delete ZooKeeper configurations used for workload generation')
delete_zoo_data_command = [
'kubectl',
'exec',
'zookeeper-client',
'--',
'bash',
'-c',
'zookeeper-shell my-confluent-cp-zookeeper:2181 deleteall /workload-generation'
]
check_zoo_data_command = [
'kubectl',
'exec',
'zookeeper-client',
'--',
'bash',
'-c',
'zookeeper-shell my-confluent-cp-zookeeper:2181 ls /'
# "| awk -F[\]\[] '{print $2}'"
]
output = subprocess.run(delete_zoo_data_command, capture_output=True, text=True)
logging.info(output.stdout)
# Wait for configuration deletion
while True:
output = subprocess.run(check_zoo_data_command, capture_output=True, text=True)
logging.debug(output)
if 'workload-generation' in output.stdout:
print('ZooKeeper reset was not successful. Retrying in 5s.')
time.sleep(5)
else:
logging.info('ZooKeeper reset was successful.')
break
return
def stop_lag_exporter(): def stop_lag_exporter():
""" """
...@@ -426,6 +467,8 @@ def main(): ...@@ -426,6 +467,8 @@ def main():
print('---------------------') print('---------------------')
delete_topics(topics) delete_topics(topics)
print('---------------------') print('---------------------')
reset_zookeeper()
print('---------------------')
stop_lag_exporter() stop_lag_exporter()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment