Skip to content

Commit

Permalink
[#613] fix counting online workers from flower, add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Blatov committed Nov 19, 2018
1 parent 70c883b commit 20123bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion legion_test/legion_test/robot/flower.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,10 @@ def get_number_of_workers_from_flower(self):
workers_number = 0
if response.get('data', []):
for item in response.get('data'):
if item.get('worker-offline', 0) != 1:
if item.get('status', False) is True:
workers_number += 1

print("Online workers number in flower is {}".format(workers_number))
return workers_number

def wait_for_worker_is_ready(self, expected_count=1):
Expand Down
4 changes: 4 additions & 0 deletions legion_test/legion_test/robot/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def get_deployment_replicas(self, deployment_name, namespace='default'):
client = self.build_client()
extension_api = kubernetes.client.ExtensionsV1beta1Api(client)
scale_data = extension_api.read_namespaced_deployment_scale(deployment_name, namespace)
print("Scale data for {} in {} enclave is {}".format(deployment_name, namespace, scale_data))
if scale_data is not None:
return scale_data.status.replicas
else:
Expand Down Expand Up @@ -233,8 +234,11 @@ def set_deployment_replicas(self, replicas, deployment_name, namespace='default'
client = self.build_client()
extension_api = kubernetes.client.ExtensionsV1beta1Api(client)
scale_data = extension_api.read_namespaced_deployment_scale(deployment_name, namespace)
print("Scale data for {} in {} enclave is {}".format(deployment_name, namespace, scale_data))
scale_data.spec.replicas = replicas
print("Setting replica to {} for {} in {} enclave".format(replicas, deployment_name, namespace))
extension_api.replace_namespaced_deployment_scale(deployment_name, namespace, scale_data)
print("Replica to {} for {} in {} enclave was set up".format(replicas, deployment_name, namespace))

def update_model_property_key(self, namespace, model_id, model_version, key, value):
"""
Expand Down

0 comments on commit 20123bf

Please sign in to comment.