-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise exception when we can't get get stats or info from a node #5
base: develop
Are you sure you want to change the base?
Conversation
This is going to happen sometimes if a node is down or even memory hogged, so that's why it continues. |
…e. If the number of failures exceeds 10, raise an exception.
I updated the node.py to keep track of how many times a node fails to populate in a row, and raise an exception if the count exceeds 10 times. |
@@ -30,6 +30,7 @@ def __init__(self, cluster, node_id=None): | |||
''' | |||
self.cluster = cluster | |||
self.node_id = node_id | |||
self.badcount = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This desperately needs a better name. What are we trying to say with this? We're trying to indicate that we've had unsuccessful or bad attempts to get info, so we should say something to that affect.
unsuccessful_cluster_info_retrieval_attempts = 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this fully (although there has to be a smaller name) at the very least keep it pythonic ;)
self.bad_result_count = 0 | ||
except Exception as e: | ||
self.bad_result_count += 1 | ||
_LOG.warning("{0} (failure {1} of {2}".format(str(e), self.bad_result_count, self.bad_result_maximum)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sprintf that's already being handled by logging, otherwise it looks ugly (and is two different format string methods being applied)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the format string has a left parentheses in there but no right?
FYI, the reasoning for it not failing upon highstate failure, was because the dpkg post-install script from Elastic themselves failed out upon upgrade once upon a time. |
So the check was removed on purpose and never added back in. |
No description provided.