Created
October 24, 2018 16:12
-
-
Save chartjes/67a752d73c5867b18bb3a9a898dbb93d to your computer and use it in GitHub Desktop.
How to make this more ideomatically pythonic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while test_completed is False: | |
ret = v1.list_pod_for_all_namespaces(watch=False) | |
for i in ret.items: | |
container_status = i.status.container_statuses | |
for container in container_status: | |
if isinstance(container.state.terminated, client.V1ContainerStateTerminated): | |
if container.state.terminated.reason == 'Completed': | |
bar.finish() | |
test_completed = True | |
if container.state.terminated.exit_code == 0: | |
print('Loadtest containers exited without errors') | |
else: | |
print('Loadtest containers exited with errors, check logs') | |
bar.update() |
Hey Tarek,
Thanks for all the suggestions. I do want the while loop to end once the containers have completed running
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One with an iterator :)