Raise exception when we can't get get stats or info from a node#5
Raise exception when we can't get get stats or info from a node#5bender-the-greatest wants to merge 5 commits intodevelopfrom
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. |
rollastic/node.py
Outdated
| ''' | ||
| self.cluster = cluster | ||
| self.node_id = node_id | ||
| self.badcount = 0 |
There was a problem hiding this comment.
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.
I agree with this fully (although there has to be a smaller name) at the very least keep it pythonic ;)
rollastic/node.py
Outdated
| 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.
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.
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.