Skip to content
Snippets Groups Projects
Commit 888c9421 authored by Björn Vonheiden's avatar Björn Vonheiden Committed by Sören Henning
Browse files

Use the streams api in run uc py to use the zookeeper-client

parent f2d4343d
No related branches found
No related tags found
No related merge requests found
...@@ -370,22 +370,14 @@ def reset_zookeeper(): ...@@ -370,22 +370,14 @@ def reset_zookeeper():
print('Delete ZooKeeper configurations used for workload generation') print('Delete ZooKeeper configurations used for workload generation')
delete_zoo_data_command = [ delete_zoo_data_command = [
'kubectl', '/bin/sh',
'exec',
'zookeeper-client',
'--',
'bash',
'-c', '-c',
'zookeeper-shell my-confluent-cp-zookeeper:2181 deleteall ' 'zookeeper-shell my-confluent-cp-zookeeper:2181 deleteall '
+ '/workload-generation' + '/workload-generation'
] ]
check_zoo_data_command = [ check_zoo_data_command = [
'kubectl', '/bin/sh',
'exec',
'zookeeper-client',
'--',
'bash',
'-c', '-c',
'zookeeper-shell my-confluent-cp-zookeeper:2181 get ' 'zookeeper-shell my-confluent-cp-zookeeper:2181 get '
+ '/workload-generation' + '/workload-generation'
...@@ -394,18 +386,25 @@ def reset_zookeeper(): ...@@ -394,18 +386,25 @@ def reset_zookeeper():
# Wait for configuration deletion # Wait for configuration deletion
while True: while True:
# Delete Zookeeper configuration data # Delete Zookeeper configuration data
output = subprocess.run(delete_zoo_data_command, resp = stream(coreApi.connect_get_namespaced_pod_exec,
capture_output=True, "zookeeper-client",
text=True) 'default',
logging.debug(output.stdout) command=delete_zoo_data_command,
stderr=True, stdin=False,
stdout=True, tty=False)
logging.debug(resp)
# Check data is deleted # Check data is deleted
output = subprocess.run(check_zoo_data_command, client = stream(coreApi.connect_get_namespaced_pod_exec,
capture_output=True, "zookeeper-client",
text=True) 'default',
logging.debug(output) command=check_zoo_data_command,
stderr=True, stdin=False,
stdout=True, tty=False,
_preload_content=False) # Get client for returncode
client.run_forever(timeout=60) # Start the client
if output.returncode == 1: # Means data not available anymore if client.returncode == 1: # Means data not available anymore
print('ZooKeeper reset was successful.') print('ZooKeeper reset was successful.')
break break
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment